summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2015-05-11 15:07:25 +0000
committerBaserock Gerrit <gerrit@baserock.org>2015-05-12 13:01:31 +0000
commiteb9e43d4ffe992cd66945a7d7fa2feb00ee49473 (patch)
treec7eb10521e03beb01741c1adaf8bb16a1f18b81c
parent43fed1ea4c6c988a08bff1a2c61087116b4a1cb1 (diff)
downloadmorph-eb9e43d4ffe992cd66945a7d7fa2feb00ee49473.tar.gz
distbuild: Set job status to failed when sending exec-cancel
Currently jobs may continue running after exec-cancel is sent if exec-response takes a while to be sent back. This commit makes the job's state be set to 'failed' when exec-cancel is sent, so that the wait for exec-response doesn't matter. Change-Id: I858d9efcba38c81a912cf57aee2bdd8c02cb466b
-rw-r--r--distbuild/worker_build_scheduler.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/distbuild/worker_build_scheduler.py b/distbuild/worker_build_scheduler.py
index ce2589d8..a62fa7f0 100644
--- a/distbuild/worker_build_scheduler.py
+++ b/distbuild/worker_build_scheduler.py
@@ -501,6 +501,14 @@ class WorkerConnection(distbuild.StateMachine):
msg = distbuild.message('exec-cancel', id=job.id)
self._jm.send(msg)
+ # NOTE: We need to set job's state to 'failed' as soon as possible.
+ # The exec-response message may take a while to arrive, and if we
+ # wait for that then it is possible that another build-request for
+ # the same artifact could be made, which would result in the build
+ # not being started since the cancelled job would still be 'running'.
+ # The new build will then fail when the exec-response for the old
+ # build finally arrives.
+ job.set_state('failed')
self.mainloop.queue_event(self, _BuildCancelled())
def _disconnected(self, event_source, event):