remove partial dependency job id logic

* Late in the release we added job dependency tracking to the DB. We
decided not to use this information in the scheduler. However, I
half-ass added code to the scheduler to use it. Note that we still
determine inv and job update dependency by using a hack of the related
creation time, job.created-2 and job.created-1 respectively.

This removes any use of job dependent id expect for purposes of chain
failing.
This commit is contained in:
Chris Meyers 2017-02-13 12:38:42 -05:00
parent d661651068
commit b693b06706

View File

@ -1,7 +1,6 @@
# Python
import json
import itertools
# AWX
from awx.main.utils import decrypt_field_value
@ -62,35 +61,13 @@ class PartialModelDict(object):
def task_impact(self):
raise RuntimeError("Inherit and implement me")
@classmethod
def merge_values(cls, values):
grouped_results = itertools.groupby(values, key=lambda value: value['id'])
merged_values = []
for k, g in grouped_results:
groups = list(g)
merged_value = {}
for group in groups:
for key, val in group.iteritems():
if not merged_value.get(key):
merged_value[key] = val
elif val != merged_value[key]:
if isinstance(merged_value[key], list):
if val not in merged_value[key]:
merged_value[key].append(val)
else:
old_val = merged_value[key]
merged_value[key] = [old_val, val]
merged_values.append(merged_value)
return merged_values
class JobDict(PartialModelDict):
FIELDS = (
'id', 'status', 'job_template_id', 'inventory_id', 'project_id',
'launch_type', 'limit', 'allow_simultaneous', 'created',
'job_type', 'celery_task_id', 'project__scm_update_on_launch',
'forks', 'start_args', 'dependent_jobs__id',
'forks', 'start_args',
)
model = Job
@ -113,8 +90,7 @@ class JobDict(PartialModelDict):
kv = {
'status__in': status
}
merged = PartialModelDict.merge_values(cls.model.objects.filter(**kv).values(*cls.get_db_values()))
return [cls(o) for o in merged]
return [cls(o) for o in cls.model.objects.filter(**kv).values(*cls.get_db_values())]
class ProjectUpdateDict(PartialModelDict):