OLD | NEW |
---|---|
1 import logging, os | 1 import logging, os |
2 from datetime import datetime | 2 from datetime import datetime |
3 from django.db import models as dbmodels, connection | 3 from django.db import models as dbmodels, connection |
4 from xml.sax import saxutils | 4 from xml.sax import saxutils |
5 import common | 5 import common |
6 from autotest_lib.frontend.afe import model_logic, model_attributes | 6 from autotest_lib.frontend.afe import model_logic, model_attributes |
7 from autotest_lib.frontend import settings, thread_local | 7 from autotest_lib.frontend import settings, thread_local |
8 from autotest_lib.client.common_lib import enum, host_protections, global_config | 8 from autotest_lib.client.common_lib import enum, host_protections, global_config |
9 from autotest_lib.client.common_lib import host_queue_entry_states | 9 from autotest_lib.client.common_lib import host_queue_entry_states |
10 | 10 |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
986 @classmethod | 986 @classmethod |
987 def create(cls, owner, options, hosts): | 987 def create(cls, owner, options, hosts): |
988 """\ | 988 """\ |
989 Creates a job by taking some information (the listed args) | 989 Creates a job by taking some information (the listed args) |
990 and filling in the rest of the necessary information. | 990 and filling in the rest of the necessary information. |
991 """ | 991 """ |
992 AclGroup.check_for_acl_violation_hosts(hosts) | 992 AclGroup.check_for_acl_violation_hosts(hosts) |
993 | 993 |
994 control_file = options.get('control_file') | 994 control_file = options.get('control_file') |
995 parameterized_job = options.get('parameterized_job') | 995 parameterized_job = options.get('parameterized_job') |
996 cls.check_parameterized_job(control_file=control_file, | |
pauldean_chromium
2011/01/10 20:32:22
The current implementation of parameterized jobs r
| |
997 parameterized_job=parameterized_job) | |
998 | 996 |
999 user = User.current_user() | 997 user = User.current_user() |
1000 if options.get('reboot_before') is None: | 998 if options.get('reboot_before') is None: |
1001 options['reboot_before'] = user.get_reboot_before_display() | 999 options['reboot_before'] = user.get_reboot_before_display() |
1002 if options.get('reboot_after') is None: | 1000 if options.get('reboot_after') is None: |
1003 options['reboot_after'] = user.get_reboot_after_display() | 1001 options['reboot_after'] = user.get_reboot_after_display() |
1004 | 1002 |
1005 drone_set = DroneSet.resolve_name(options.get('drone_set')) | 1003 drone_set = DroneSet.resolve_name(options.get('drone_set')) |
1006 | 1004 |
1007 job = cls.add_object( | 1005 job = cls.add_object( |
(...skipping 17 matching lines...) Expand all Loading... | |
1025 job.dependency_labels = options['dependencies'] | 1023 job.dependency_labels = options['dependencies'] |
1026 | 1024 |
1027 if options.get('keyvals'): | 1025 if options.get('keyvals'): |
1028 for key, value in options['keyvals'].iteritems(): | 1026 for key, value in options['keyvals'].iteritems(): |
1029 JobKeyval.objects.create(job=job, key=key, value=value) | 1027 JobKeyval.objects.create(job=job, key=key, value=value) |
1030 | 1028 |
1031 return job | 1029 return job |
1032 | 1030 |
1033 | 1031 |
1034 def save(self, *args, **kwargs): | 1032 def save(self, *args, **kwargs): |
1035 self.check_parameterized_job(control_file=self.control_file, | |
1036 parameterized_job=self.parameterized_job) | |
1037 super(Job, self).save(*args, **kwargs) | 1033 super(Job, self).save(*args, **kwargs) |
1038 | 1034 |
1039 | 1035 |
1040 def queue(self, hosts, atomic_group=None, is_template=False): | 1036 def queue(self, hosts, atomic_group=None, is_template=False): |
1041 """Enqueue a job on the given hosts.""" | 1037 """Enqueue a job on the given hosts.""" |
1042 if not hosts: | 1038 if not hosts: |
1043 if atomic_group: | 1039 if atomic_group: |
1044 # No hosts or labels are required to queue an atomic group | 1040 # No hosts or labels are required to queue an atomic group |
1045 # Job. However, if they are given, we respect them below. | 1041 # Job. However, if they are given, we respect them below. |
1046 atomic_group.enqueue_job(self, is_template=is_template) | 1042 atomic_group.enqueue_job(self, is_template=is_template) |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1393 | 1389 |
1394 def __unicode__(self): | 1390 def __unicode__(self): |
1395 result = u'Special Task %s (host %s, task %s, time %s)' % ( | 1391 result = u'Special Task %s (host %s, task %s, time %s)' % ( |
1396 self.id, self.host, self.task, self.time_requested) | 1392 self.id, self.host, self.task, self.time_requested) |
1397 if self.is_complete: | 1393 if self.is_complete: |
1398 result += u' (completed)' | 1394 result += u' (completed)' |
1399 elif self.is_active: | 1395 elif self.is_active: |
1400 result += u' (active)' | 1396 result += u' (active)' |
1401 | 1397 |
1402 return result | 1398 return result |
OLD | NEW |