Commit a71e4097 authored by André Anjos's avatar André Anjos 💬

[backend] Fix to job updates with parent jobs

parent 67f34f27
......@@ -680,31 +680,35 @@ class Job(models.Model):
if self.done(): return
split_statuses = self.splits.values_list('status', flat=True)
# If this process has a parent, then don't try to get split statuses
if not self.parent:
if self.start_date is None:
self.start_date = \
self.splits.order_by('start_date').first().start_date
split_statuses = self.splits.values_list('status', flat=True)
# Process main status and status from job results
if Job.FAILED in split_statuses:
self.status = Job.FAILED
if self.start_date is None:
self.start_date = \
self.splits.order_by('start_date').first().start_date
elif Job.CANCELLED in split_statuses:
self.status = Job.CANCELLED
# Process main status and status from job results
if Job.FAILED in split_statuses:
self.status = Job.FAILED
elif (Job.PROCESSING in split_statuses) or \
(Job.QUEUED in split_statuses and Job.COMPLETED in split_statuses):
self.status = Job.PROCESSING
elif Job.CANCELLED in split_statuses:
self.status = Job.CANCELLED
elif all([s == Job.SKIPPED for s in split_statuses]):
self.status = Job.SKIPPED
elif (Job.PROCESSING in split_statuses) or \
(Job.QUEUED in split_statuses and \
Job.COMPLETED in split_statuses):
self.status = Job.PROCESSING
elif Job.QUEUED not in split_statuses:
self.status = Job.COMPLETED
elif all([s == Job.SKIPPED for s in split_statuses]):
self.status = Job.SKIPPED
else:
self.status = Job.QUEUED
elif Job.QUEUED not in split_statuses:
self.status = Job.COMPLETED
else:
self.status = Job.QUEUED
# if required, erase dangling files, update own results
timings = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment