Dynamically determine synch_count.

This patch adds an additional field called synch_job to pairings. If pairing.synch_job=True, invoke_test() sets synch_count=len(hosts) . In other cases, it reads synch_count from the control file.

Signed-off-by: Nikhil Rao <ncrao@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@2805 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/frontend.py b/server/frontend.py
index 336de05..5637c91 100644
--- a/server/frontend.py
+++ b/server/frontend.py
@@ -199,7 +199,10 @@
         dargs['dependencies'] = dargs.get('dependencies', []) + \
                                 control_file.dependencies
         dargs['control_file'] = control_file.control_file
-        dargs['synch_count'] = control_file.synch_count
+	if 'synch_count' not in dargs:
+            dargs['synch_count'] = control_file.synch_count
+	else:
+	    control_file.synch_count = dargs['synch_count']
         jobs = []
         if control_file.synch_count > 1:
             # We don't trust the scheduler to do the groupings for us.
@@ -379,6 +382,8 @@
         hosts = [h for h in hosts if self._included_platform(h, platforms)]
         host_list = [h.hostname for h in hosts if h.status != 'Repair Failed']
         print 'HOSTS: %s' % host_list
+	if pairing.synch_job:
+	    dargs['synch_count'] = len(host_list)
         new_jobs = self.create_job_by_test(name=job_name,
                                            dependencies=[pairing.machine_label],
                                            tests=[pairing.control_file],
@@ -725,11 +730,12 @@
     platforms: list of rexeps to filter platforms by. [] => no filtering
     """
     def __init__(self, machine_label, control_file, platforms=[],
-                 container=False):
+                 container=False, synch_job=False):
         self.machine_label = machine_label
         self.control_file = control_file
         self.platforms = platforms
         self.container = container
+	self.synch_job = synch_job
 
 
     def __repr__(self):