| OLD | NEW |
| 1 # | 1 # |
| 2 # Copyright 2008 Google Inc. All Rights Reserved. | 2 # Copyright 2008 Google Inc. All Rights Reserved. |
| 3 | 3 |
| 4 """ | 4 """ |
| 5 The job module contains the objects and methods used to | 5 The job module contains the objects and methods used to |
| 6 manage jobs in Autotest. | 6 manage jobs in Autotest. |
| 7 | 7 |
| 8 The valid actions are: | 8 The valid actions are: |
| 9 list: lists job(s) | 9 list: lists job(s) |
| 10 create: create a job | 10 create: create a job |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 | 595 |
| 596 def execute(self): | 596 def execute(self): |
| 597 clone_info = self.execute_rpc(op='get_info_for_clone', | 597 clone_info = self.execute_rpc(op='get_info_for_clone', |
| 598 id=self.clone_id, | 598 id=self.clone_id, |
| 599 preserve_metahosts=self.reuse_hosts) | 599 preserve_metahosts=self.reuse_hosts) |
| 600 | 600 |
| 601 # Remove fields from clone data that cannot be reused | 601 # Remove fields from clone data that cannot be reused |
| 602 for field in ('name', 'created_on', 'id', 'owner'): | 602 for field in ('name', 'created_on', 'id', 'owner'): |
| 603 del clone_info['job'][field] | 603 del clone_info['job'][field] |
| 604 | 604 |
| 605 # Also remove parameterized_job field, as the feature still is | |
| 606 # incomplete, this tool does not attempt to support it for now, | |
| 607 # it uses a different API function and it breaks create_job() | |
| 608 if clone_info['job'].has_key('parameterized_job'): | |
| 609 del clone_info['job']['parameterized_job'] | |
| 610 | |
| 611 # Keyword args cannot be unicode strings | 605 # Keyword args cannot be unicode strings |
| 612 self.data.update((str(key), val) | 606 self.data.update((str(key), val) |
| 613 for key, val in clone_info['job'].iteritems()) | 607 for key, val in clone_info['job'].iteritems()) |
| 614 | 608 |
| 615 if self.reuse_hosts: | 609 if self.reuse_hosts: |
| 616 # Convert host list from clone info that can be used for job_create | 610 # Convert host list from clone info that can be used for job_create |
| 617 for label, qty in clone_info['meta_host_counts'].iteritems(): | 611 for label, qty in clone_info['meta_host_counts'].iteritems(): |
| 618 self.data['meta_hosts'].extend([label]*qty) | 612 self.data['meta_hosts'].extend([label]*qty) |
| 619 | 613 |
| 620 self.data['hosts'].extend(host['hostname'] | 614 self.data['hosts'].extend(host['hostname'] |
| (...skipping 15 matching lines...) Expand all Loading... |
| 636 | 630 |
| 637 | 631 |
| 638 def execute(self): | 632 def execute(self): |
| 639 data = {'job__id__in': self.jobids} | 633 data = {'job__id__in': self.jobids} |
| 640 self.execute_rpc(op='abort_host_queue_entries', **data) | 634 self.execute_rpc(op='abort_host_queue_entries', **data) |
| 641 print 'Aborting jobs: %s' % ', '.join(self.jobids) | 635 print 'Aborting jobs: %s' % ', '.join(self.jobids) |
| 642 | 636 |
| 643 | 637 |
| 644 def get_items(self): | 638 def get_items(self): |
| 645 return self.jobids | 639 return self.jobids |
| OLD | NEW |