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

[backend,experiments] Test fixes; More tests

parent 190ea5e3
Pipeline #1558 failed with stage
......@@ -647,7 +647,7 @@ class Job(models.Model):
for b in self.block.dependents.all():
if any([k.status in (Block.FAILED, Block.CANCELLED) \
for k in b.dependencies.all()]):
for split in b.job.splits: split.end(None, Job.CANCELLED)
b.job._cancel()
if all([k.status in (Block.CACHED, Block.SKIPPED) \
for k in b.dependencies.all()]):
b.job.make_runnable()
......@@ -708,7 +708,7 @@ class Job(models.Model):
# if required, erase dangling files, update own results
timings = None
if self.done():
if self.done() and self.status != Job.CANCELLED:
# compute final timings and update parent block
if self.status != Job.SKIPPED:
diff_timings = self._merge_results()
......@@ -740,7 +740,7 @@ class Job(models.Model):
failed = self.status in (Job.FAILED, Job.CANCELLED)
if failed:
for o in self.block.outputs: l += o.files()
for o in self.block.outputs.all(): l += o.files()
for f in l:
logger.info("Erasing output file `%s' because Job `%s' failed", f,
......@@ -764,8 +764,13 @@ class Job(models.Model):
logger.info("Marking job `%s' as 'cancelled'", self)
self.runnable_date = None
self.start_date = None
for s in self.splits: s._cancel()
self.save()
if self.splits.count():
for s in self.splits.all(): s._cancel()
else:
self.status = Job.CANCELLED
self.save()
self.block._update_state()
self._cascade_updates()
def _merge_results(self):
......@@ -960,7 +965,7 @@ class JobSplit(models.Model):
if result.id is None: result.save()
self.result = result
else:
self.status = state
self.status = status
self.save()
......
This diff is collapsed.
......@@ -998,7 +998,8 @@ class Block(models.Model):
if self.done(): return
if hasattr(self, 'job'): self.job._cancel()
if hasattr(self, 'job'):
self.job._cancel()
else:
self.status = Block.CANCELLED
self.save()
......@@ -1060,7 +1061,9 @@ class Block(models.Model):
if self.job.done():
self.end_date = self.job.end_date
self.job.result.delete() #cascades to job/job split deletion
r = self.job.result
self.job.delete()
if r: r.delete()
# Loads Results from cache
if self.job.result and self.analyzer and self.status == Block.CACHED:
......
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