| 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 """atest job create [--priority <Low|Medium|High|Urgent>] | 355 """atest job create [--priority <Low|Medium|High|Urgent>] |
| 356 [--synch_count] [--control-file </path/to/cfile>] | 356 [--synch_count] [--control-file </path/to/cfile>] |
| 357 [--on-server] [--test <test1,test2>] [--kernel <http://kernel>] | 357 [--on-server] [--test <test1,test2>] [--kernel <http://kernel>] |
| 358 [--mlist </path/to/machinelist>] [--machine <host1 host2 host3>] | 358 [--mlist </path/to/machinelist>] [--machine <host1 host2 host3>] |
| 359 [--labels <list of labels of machines to run on>] | 359 [--labels <list of labels of machines to run on>] |
| 360 [--reboot_before <option>] [--reboot_after <option>] | 360 [--reboot_before <option>] [--reboot_after <option>] |
| 361 [--noverify] [--timeout <timeout>] [--max_runtime <max runtime>] | 361 [--noverify] [--timeout <timeout>] [--max_runtime <max runtime>] |
| 362 [--one-time-hosts <hosts>] [--email <email>] | 362 [--one-time-hosts <hosts>] [--email <email>] |
| 363 [--dependencies <labels this job is dependent on>] | 363 [--dependencies <labels this job is dependent on>] |
| 364 [--atomic_group <atomic group name>] [--parse-failed-repair <option>] | 364 [--atomic_group <atomic group name>] [--parse-failed-repair <option>] |
| 365 [--image <http://path/to/image>] |
| 365 job_name | 366 job_name |
| 366 | 367 |
| 367 Creating a job is rather different from the other create operations, | 368 Creating a job is rather different from the other create operations, |
| 368 so it only uses the __init__() and output() from its superclass. | 369 so it only uses the __init__() and output() from its superclass. |
| 369 """ | 370 """ |
| 370 op_action = 'create' | 371 op_action = 'create' |
| 371 | 372 |
| 372 def __init__(self): | 373 def __init__(self): |
| 373 super(job_create, self).__init__() | 374 super(job_create, self).__init__() |
| 374 self.ctrl_file_data = {} | 375 self.ctrl_file_data = {} |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 type='choice', | 417 type='choice', |
| 417 choices=('true', 'false')) | 418 choices=('true', 'false')) |
| 418 self.parser.add_option('-n', '--noverify', | 419 self.parser.add_option('-n', '--noverify', |
| 419 help='Do not run verify for job', | 420 help='Do not run verify for job', |
| 420 default=False, action='store_true') | 421 default=False, action='store_true') |
| 421 self.parser.add_option('-o', '--timeout', help='Job timeout in hours.', | 422 self.parser.add_option('-o', '--timeout', help='Job timeout in hours.', |
| 422 metavar='TIMEOUT') | 423 metavar='TIMEOUT') |
| 423 self.parser.add_option('--max_runtime', | 424 self.parser.add_option('--max_runtime', |
| 424 help='Job maximum runtime in hours') | 425 help='Job maximum runtime in hours') |
| 425 | 426 |
| 427 self.parser.add_option('-i', '--image', |
| 428 help='OS image to install before running the ' |
| 429 'test.') |
| 430 |
| 426 | 431 |
| 427 @staticmethod | 432 @staticmethod |
| 428 def _get_kernel_data(kernel_list, cmdline): | 433 def _get_kernel_data(kernel_list, cmdline): |
| 429 # the RPC supports cmdline per kernel version in a dictionary | 434 # the RPC supports cmdline per kernel version in a dictionary |
| 430 kernels = [] | 435 kernels = [] |
| 431 for version in re.split(r'[, ]+', kernel_list): | 436 for version in re.split(r'[, ]+', kernel_list): |
| 432 if not version: | 437 if not version: |
| 433 continue | 438 continue |
| 434 kernel_info = {'version': version} | 439 kernel_info = {'version': version} |
| 435 if cmdline: | 440 if cmdline: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 else: | 479 else: |
| 475 self.data['control_file'] = control_file_data | 480 self.data['control_file'] = control_file_data |
| 476 if options.test: | 481 if options.test: |
| 477 if options.server: | 482 if options.server: |
| 478 self.invalid_syntax('If you specify tests, then the ' | 483 self.invalid_syntax('If you specify tests, then the ' |
| 479 'client/server setting is implicit and ' | 484 'client/server setting is implicit and ' |
| 480 'cannot be overriden.') | 485 'cannot be overriden.') |
| 481 tests = [t.strip() for t in options.test.split(',') if t.strip()] | 486 tests = [t.strip() for t in options.test.split(',') if t.strip()] |
| 482 self.ctrl_file_data['tests'] = tests | 487 self.ctrl_file_data['tests'] = tests |
| 483 | 488 |
| 489 if options.image: |
| 490 self.data['image'] = options.image |
| 484 | 491 |
| 485 if options.reboot_before: | 492 if options.reboot_before: |
| 486 self.data['reboot_before'] = options.reboot_before.capitalize() | 493 self.data['reboot_before'] = options.reboot_before.capitalize() |
| 487 if options.reboot_after: | 494 if options.reboot_after: |
| 488 self.data['reboot_after'] = options.reboot_after.capitalize() | 495 self.data['reboot_after'] = options.reboot_after.capitalize() |
| 489 if options.parse_failed_repair: | 496 if options.parse_failed_repair: |
| 490 self.data['parse_failed_repair'] = ( | 497 self.data['parse_failed_repair'] = ( |
| 491 options.parse_failed_repair == 'true') | 498 options.parse_failed_repair == 'true') |
| 492 if options.noverify: | 499 if options.noverify: |
| 493 self.data['run_verify'] = False | 500 self.data['run_verify'] = False |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 | 637 |
| 631 | 638 |
| 632 def execute(self): | 639 def execute(self): |
| 633 data = {'job__id__in': self.jobids} | 640 data = {'job__id__in': self.jobids} |
| 634 self.execute_rpc(op='abort_host_queue_entries', **data) | 641 self.execute_rpc(op='abort_host_queue_entries', **data) |
| 635 print 'Aborting jobs: %s' % ', '.join(self.jobids) | 642 print 'Aborting jobs: %s' % ', '.join(self.jobids) |
| 636 | 643 |
| 637 | 644 |
| 638 def get_items(self): | 645 def get_items(self): |
| 639 return self.jobids | 646 return self.jobids |
| OLD | NEW |