Eep, I broke the "Reinstall" button the View Host tab with this change, but the fix is pretty trivial (at least for now). Perhaps this indicates the profiles should be merged with the hosts earlier in the API.
--- The reinstall job bypasses the profile selection, but zip() will fail to actually produce any results if the arrays don't match in size. So fix this by creating a dummy array of None values for the profile in that case. Signed-off-by: Nishanth Aravamudan <n...@us.ibm.com> diff --git a/frontend/afe/models.py b/frontend/afe/models.py index 1d16140..5b6bd6a 100644 --- a/frontend/afe/models.py +++ b/frontend/afe/models.py @@ -1053,6 +1053,8 @@ class Job(dbmodels.Model, model_logic.ModelExtensions): entry.save() return + if not profiles: + profiles = [None] * len(hosts) for host,profile in zip(hosts,profiles): host.enqueue_job(self, profile=profile, atomic_group=atomic_group, is_template=is_template) On 08.03.2012 [16:41:54 -0800], Nishanth Aravamudan wrote: > When we get a new job from afe, we might also get a list of profiles to > go with the hosts, and need to pass this down into the HostQueueEntry > logic eventually. > > Signed-off-by: Nishanth Aravamudan <n...@us.ibm.com> > > --- > frontend/afe/models.py | 14 +++++++------- > frontend/afe/rpc_interface.py | 3 ++- > frontend/afe/rpc_utils.py | 7 ++++--- > 3 files changed, 13 insertions(+), 11 deletions(-) > > diff --git a/frontend/afe/models.py b/frontend/afe/models.py > index 96c56e9..1d16140 100644 > --- a/frontend/afe/models.py > +++ b/frontend/afe/models.py > @@ -414,9 +414,9 @@ class Host(model_logic.ModelWithInvalid, dbmodels.Model, > logging.info(self.hostname + ' -> ' + self.status) > > > - def enqueue_job(self, job, atomic_group=None, is_template=False): > + def enqueue_job(self, job, profile, atomic_group=None, > is_template=False): > """Enqueue a job on this host.""" > - queue_entry = HostQueueEntry.create(host=self, job=job, > + queue_entry = HostQueueEntry.create(host=self, job=job, > profile=profile, > is_template=is_template, > atomic_group=atomic_group) > # allow recovery of dead hosts from the frontend > @@ -1040,7 +1040,7 @@ class Job(dbmodels.Model, model_logic.ModelExtensions): > super(Job, self).save(*args, **kwargs) > > > - def queue(self, hosts, atomic_group=None, is_template=False): > + def queue(self, hosts, profiles, atomic_group=None, is_template=False): > """Enqueue a job on the given hosts.""" > if not hosts: > if atomic_group: > @@ -1053,8 +1053,8 @@ class Job(dbmodels.Model, model_logic.ModelExtensions): > entry.save() > return > > - for host in hosts: > - host.enqueue_job(self, atomic_group=atomic_group, > + for host,profile in zip(hosts,profiles): > + host.enqueue_job(self, profile=profile, > atomic_group=atomic_group, > is_template=is_template) > > > @@ -1148,14 +1148,14 @@ class HostQueueEntry(dbmodels.Model, > model_logic.ModelExtensions): > > > @classmethod > - def create(cls, job, host=None, meta_host=None, atomic_group=None, > + def create(cls, job, host=None, profile=None, meta_host=None, > atomic_group=None, > is_template=False): > if is_template: > status = cls.Status.TEMPLATE > else: > status = cls.Status.QUEUED > > - return cls(job=job, host=host, meta_host=meta_host, > + return cls(job=job, host=host, profile=profile, meta_host=meta_host, > atomic_group=atomic_group, status=status) > > > diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py > index 3a302dc..bd08715 100644 > --- a/frontend/afe/rpc_interface.py > +++ b/frontend/afe/rpc_interface.py > @@ -496,7 +496,7 @@ def create_parameterized_job(name, priority, test, > parameters, kernel=None, > > > def create_job(name, priority, control_file, control_type, > - hosts=(), meta_hosts=(), one_time_hosts=(), > + hosts=(), profiles=(), meta_hosts=(), one_time_hosts=(), > atomic_group_name=None, synch_count=None, is_template=False, > timeout=None, max_runtime_hrs=None, run_verify=True, > email_list='', dependencies=(), reboot_before=None, > @@ -526,6 +526,7 @@ def create_job(name, priority, control_file, control_type, > @param keyvals dict of keyvals to associate with the job > > @param hosts List of hosts to run job on. > + @param profiles List of profiles to use, in sync with @hosts list > @param meta_hosts List where each entry is a label name, and for each > entry > one host will be chosen from that label to run the job on. > @param one_time_hosts List of hosts not in the database to run the job > on. > diff --git a/frontend/afe/rpc_utils.py b/frontend/afe/rpc_utils.py > index 7250d92..8527d39 100644 > --- a/frontend/afe/rpc_utils.py > +++ b/frontend/afe/rpc_utils.py > @@ -454,7 +454,7 @@ def check_for_duplicate_hosts(host_objects): > % ', '.join(duplicate_hostnames)}) > > > -def create_new_job(owner, options, host_objects, metahost_objects, > +def create_new_job(owner, options, host_objects, profiles, metahost_objects, > atomic_group=None): > labels_by_name = dict((label.name, label) > for label in models.Label.objects.all()) > @@ -507,7 +507,7 @@ def create_new_job(owner, options, host_objects, > metahost_objects, > > job = models.Job.create(owner=owner, options=options, > hosts=all_host_objects) > - job.queue(all_host_objects, atomic_group=atomic_group, > + job.queue(all_host_objects, profiles=profiles, atomic_group=atomic_group, > is_template=options.get('is_template', False)) > return job.id > > @@ -636,7 +636,7 @@ def get_create_job_common_args(local_args): > > > def create_job_common(name, priority, control_type, control_file=None, > - hosts=(), meta_hosts=(), one_time_hosts=(), > + hosts=(), profiles=(), meta_hosts=(), > one_time_hosts=(), > atomic_group_name=None, synch_count=None, > is_template=False, timeout=None, max_runtime_hrs=None, > run_verify=True, email_list='', dependencies=(), > @@ -749,5 +749,6 @@ def create_job_common(name, priority, control_type, > control_file=None, > return create_new_job(owner=owner, > options=options, > host_objects=host_objects, > + profiles=profiles, > metahost_objects=metahost_objects, > atomic_group=atomic_group) > -- > 1.7.7.6 > > > -- > Nishanth Aravamudan <n...@us.ibm.com> > IBM Linux Technology Center > > _______________________________________________ > Autotest mailing list > Autotest@test.kernel.org > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest > -- Nishanth Aravamudan <n...@us.ibm.com> IBM Linux Technology Center _______________________________________________ Autotest mailing list Autotest@test.kernel.org http://test.kernel.org/cgi-bin/mailman/listinfo/autotest