From eb9e43d4ffe992cd66945a7d7fa2feb00ee49473 Mon Sep 17 00:00:00 2001 From: Adam Coldrick Date: Mon, 11 May 2015 15:07:25 +0000 Subject: 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 --- distbuild/worker_build_scheduler.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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): -- cgit v1.2.1