From df0fb06741e9bcdc4752d09b4f4472998e790a42 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 28 Jan 2009 14:46:58 +0000 Subject: [PATCH] Fix some issues related to job cancelling This patch fixes two issues with the cancel mechanism: - cancelled jobs show as such, and not in error state (we mark them as OP_STATUS_CANCELED and not OP_STATUS_ERROR) - queued jobs which are cancelled don't raise errors in the master (we treat OP_STATUS_CANCELED now) Reviewed-by: imsnah --- lib/jqueue.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/jqueue.py b/lib/jqueue.py index dcdce1e28..7e396b007 100644 --- a/lib/jqueue.py +++ b/lib/jqueue.py @@ -359,6 +359,8 @@ class _JobQueueWorker(workerpool.BaseWorker): queue.acquire() try: + if op.status == constants.OP_STATUS_CANCELED: + raise CancelJob() assert op.status == constants.OP_STATUS_QUEUED job.run_op_index = idx op.status = constants.OP_STATUS_WAITLOCK @@ -1120,7 +1122,7 @@ class JobQueue(object): """ try: for op in job.ops: - op.status = constants.OP_STATUS_ERROR + op.status = constants.OP_STATUS_CANCELED op.result = "Job canceled by request" finally: self.UpdateJobUnlocked(job) -- GitLab