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, | |
997 parameterized_job=parameterized_job) | |
998 | 996 |
997 # The current implementation of parameterized jobs requires that only | |
998 # control files or parameterized jobs are used. Using the image | |
999 # parameter on autoupdate_ParameterizedJob doesn't mix pure | |
1000 # parameterized jobs and control files jobs, it does muck enough with | |
1001 # normal jobs by adding a parameterized id to them that this check will | |
1002 # fail. So for now we just skip this check. | |
1003 # cls.check_parameterized_job(control_file=control_file, | |
1004 # parameterized_job=parameterized_job) | |
999 user = User.current_user() | 1005 user = User.current_user() |
1000 if options.get('reboot_before') is None: | 1006 if options.get('reboot_before') is None: |
1001 options['reboot_before'] = user.get_reboot_before_display() | 1007 options['reboot_before'] = user.get_reboot_before_display() |
1002 if options.get('reboot_after') is None: | 1008 if options.get('reboot_after') is None: |
1003 options['reboot_after'] = user.get_reboot_after_display() | 1009 options['reboot_after'] = user.get_reboot_after_display() |
1004 | 1010 |
1005 drone_set = DroneSet.resolve_name(options.get('drone_set')) | 1011 drone_set = DroneSet.resolve_name(options.get('drone_set')) |
1006 | 1012 |
1007 job = cls.add_object( | 1013 job = cls.add_object( |
1008 owner=owner, | 1014 owner=owner, |
(...skipping 16 matching lines...) Expand all Loading... | |
1025 job.dependency_labels = options['dependencies'] | 1031 job.dependency_labels = options['dependencies'] |
1026 | 1032 |
1027 if options.get('keyvals'): | 1033 if options.get('keyvals'): |
1028 for key, value in options['keyvals'].iteritems(): | 1034 for key, value in options['keyvals'].iteritems(): |
1029 JobKeyval.objects.create(job=job, key=key, value=value) | 1035 JobKeyval.objects.create(job=job, key=key, value=value) |
1030 | 1036 |
1031 return job | 1037 return job |
1032 | 1038 |
1033 | 1039 |
1034 def save(self, *args, **kwargs): | 1040 def save(self, *args, **kwargs): |
1035 self.check_parameterized_job(control_file=self.control_file, | 1041 # The current implementation of parameterized jobs requires that only |
1036 parameterized_job=self.parameterized_job) | 1042 # control files or parameterized jobs are used. Using the image |
1043 # parameter on autoupdate_ParameterizedJob doesn't mix pure | |
1044 # parameterized jobs and control files jobs, it does muck enough with | |
1045 # normal jobs by adding a parameterized id to them that this check will | |
1046 # fail. So for now we just skip this check. | |
1047 # cls.check_parameterized_job(control_file=control_file, | |
1048 # parameterized_job=parameterized_job) | |
truty1
2011/02/01 01:21:31
I'm going to point out something I noticed when pa
| |
1037 super(Job, self).save(*args, **kwargs) | 1049 super(Job, self).save(*args, **kwargs) |
1038 | 1050 |
1039 | 1051 |
1040 def queue(self, hosts, atomic_group=None, is_template=False): | 1052 def queue(self, hosts, atomic_group=None, is_template=False): |
1041 """Enqueue a job on the given hosts.""" | 1053 """Enqueue a job on the given hosts.""" |
1042 if not hosts: | 1054 if not hosts: |
1043 if atomic_group: | 1055 if atomic_group: |
1044 # No hosts or labels are required to queue an atomic group | 1056 # No hosts or labels are required to queue an atomic group |
1045 # Job. However, if they are given, we respect them below. | 1057 # Job. However, if they are given, we respect them below. |
1046 atomic_group.enqueue_job(self, is_template=is_template) | 1058 atomic_group.enqueue_job(self, is_template=is_template) |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1393 | 1405 |
1394 def __unicode__(self): | 1406 def __unicode__(self): |
1395 result = u'Special Task %s (host %s, task %s, time %s)' % ( | 1407 result = u'Special Task %s (host %s, task %s, time %s)' % ( |
1396 self.id, self.host, self.task, self.time_requested) | 1408 self.id, self.host, self.task, self.time_requested) |
1397 if self.is_complete: | 1409 if self.is_complete: |
1398 result += u' (completed)' | 1410 result += u' (completed)' |
1399 elif self.is_active: | 1411 elif self.is_active: |
1400 result += u' (active)' | 1412 result += u' (active)' |
1401 | 1413 |
1402 return result | 1414 return result |
OLD | NEW |