From 320d1daf1f0356cfca6a9e511d2d23505865f9e7 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Fri, 8 Oct 2010 16:01:32 +0200 Subject: [PATCH] =?UTF-8?q?jqueue:=20Resume=20jobs=20from=20=E2=80=9Cwaitl?= =?UTF-8?q?ock=E2=80=9D=20status=20(2nd=20try)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 5ef699a0e had to roll back an earlier attempt at implementing this. With the improved job queue processer, this is finally possible. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/jqueue.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/jqueue.py b/lib/jqueue.py index 908c6741c..654c68143 100644 --- a/lib/jqueue.py +++ b/lib/jqueue.py @@ -1242,15 +1242,22 @@ class JobQueue(object): status = job.CalcStatus() - if status in (constants.JOB_STATUS_QUEUED, ): + if status == constants.JOB_STATUS_QUEUED: restartjobs.append(job) elif status in (constants.JOB_STATUS_RUNNING, constants.JOB_STATUS_WAITLOCK, constants.JOB_STATUS_CANCELING): logging.warning("Unfinished job %s found: %s", job.id, job) - job.MarkUnfinishedOps(constants.OP_STATUS_ERROR, - "Unclean master daemon shutdown") + + if status == constants.JOB_STATUS_WAITLOCK: + # Restart job + job.MarkUnfinishedOps(constants.OP_STATUS_QUEUED, None) + restartjobs.append(job) + else: + job.MarkUnfinishedOps(constants.OP_STATUS_ERROR, + "Unclean master daemon shutdown") + self.UpdateJobUnlocked(job) if restartjobs: -- GitLab