always chain failures

* When inv and proj updates trigger from a JT run, if either update
fails then the job template should get marked failed. Before this
commit, the job template would get marked failed ONLY if there was
enough capacity to run all the associated updates within the same
schedule() call. If, instead, the associated updates were ran in another
schedule() call, the failure chain was lost. This changeset fixes that
by saving the necessary data in the dependent_jobs relationship so that
the failure is always chained.
This commit is contained in:
Chris Meyers
2016-12-05 15:30:21 -05:00
parent 0d8f14647f
commit cc7c2957cf
5 changed files with 100 additions and 3 deletions

View File

@@ -353,6 +353,10 @@ class UnifiedJobTypeStringMixin(object):
def _underscore_to_camel(cls, word):
return ''.join(x.capitalize() or '_' for x in word.split('_'))
@classmethod
def _camel_to_underscore(cls, word):
return re.sub('(?!^)([A-Z]+)', r'_\1', word).lower()
@classmethod
def _model_type(cls, job_type):
# Django >= 1.9
@@ -371,6 +375,9 @@ class UnifiedJobTypeStringMixin(object):
return None
return model.objects.get(id=job_id)
def model_to_str(self):
return UnifiedJobTypeStringMixin._camel_to_underscore(self.__class__.__name__)
class UnifiedJob(PolymorphicModel, PasswordFieldsModel, CommonModelNameNotUnique, UnifiedJobTypeStringMixin):
'''