| OLD | NEW |
| 1 """\ | 1 """\ |
| 2 Utility functions for rpc_interface.py. We keep them in a separate file so that | 2 Utility functions for rpc_interface.py. We keep them in a separate file so that |
| 3 only RPC interface functions go into that file. | 3 only RPC interface functions go into that file. |
| 4 """ | 4 """ |
| 5 | 5 |
| 6 __author__ = 'showard@google.com (Steve Howard)' | 6 __author__ = 'showard@google.com (Steve Howard)' |
| 7 | 7 |
| 8 import datetime, os, sys, inspect | 8 import datetime, os, sys, inspect |
| 9 import django.http | 9 import django.http |
| 10 from autotest_lib.frontend.afe import models, model_logic, model_attributes | 10 from autotest_lib.frontend.afe import models, model_logic, model_attributes |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 # check that hosts satisfy dependencies | 226 # check that hosts satisfy dependencies |
| 227 host_ids = [host.id for host in host_objects] | 227 host_ids = [host.id for host in host_objects] |
| 228 hosts_in_job = models.Host.objects.filter(id__in=host_ids) | 228 hosts_in_job = models.Host.objects.filter(id__in=host_ids) |
| 229 ok_hosts = hosts_in_job | 229 ok_hosts = hosts_in_job |
| 230 for index, dependency in enumerate(job_dependencies): | 230 for index, dependency in enumerate(job_dependencies): |
| 231 ok_hosts = ok_hosts.filter(labels__name=dependency) | 231 ok_hosts = ok_hosts.filter(labels__name=dependency) |
| 232 failing_hosts = (set(host.hostname for host in host_objects) - | 232 failing_hosts = (set(host.hostname for host in host_objects) - |
| 233 set(host.hostname for host in ok_hosts)) | 233 set(host.hostname for host in ok_hosts)) |
| 234 if failing_hosts: | 234 if failing_hosts: |
| 235 raise model_logic.ValidationError( | 235 raise model_logic.ValidationError( |
| 236 {'hosts' : 'Host(s) failed to meet job dependencies: ' + | 236 {'hosts' : 'Host(s) failed to meet job dependencies (' + |
| 237 ', '.join(failing_hosts)}) | 237 (', '.join(job_dependencies)) + '): ' + |
| 238 (', '.join(failing_hosts))}) |
| 239 |
| 238 | 240 |
| 239 | 241 |
| 240 def _execution_key_for(host_queue_entry): | 242 def _execution_key_for(host_queue_entry): |
| 241 return (host_queue_entry.job.id, host_queue_entry.execution_subdir) | 243 return (host_queue_entry.job.id, host_queue_entry.execution_subdir) |
| 242 | 244 |
| 243 | 245 |
| 244 def check_abort_synchronous_jobs(host_queue_entries): | 246 def check_abort_synchronous_jobs(host_queue_entries): |
| 245 # ensure user isn't aborting part of a synchronous autoserv execution | 247 # ensure user isn't aborting part of a synchronous autoserv execution |
| 246 count_per_execution = {} | 248 count_per_execution = {} |
| 247 for queue_entry in host_queue_entries: | 249 for queue_entry in host_queue_entries: |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 reboot_after=reboot_after, | 744 reboot_after=reboot_after, |
| 743 parse_failed_repair=parse_failed_repair, | 745 parse_failed_repair=parse_failed_repair, |
| 744 keyvals=keyvals, | 746 keyvals=keyvals, |
| 745 drone_set=drone_set, | 747 drone_set=drone_set, |
| 746 parameterized_job=parameterized_job) | 748 parameterized_job=parameterized_job) |
| 747 return create_new_job(owner=owner, | 749 return create_new_job(owner=owner, |
| 748 options=options, | 750 options=options, |
| 749 host_objects=host_objects, | 751 host_objects=host_objects, |
| 750 metahost_objects=metahost_objects, | 752 metahost_objects=metahost_objects, |
| 751 atomic_group=atomic_group) | 753 atomic_group=atomic_group) |
| OLD | NEW |