From abc1f2cea2bc1bec7b45f2214018758fa2c35cf6 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Fri, 8 Aug 2008 11:21:59 +0000 Subject: [PATCH] jqueue: Move archived jobs on all nodes Otherwise one might have archived jobs back in the list after a master failover. Reviewed-by: iustinp --- lib/jqueue.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/jqueue.py b/lib/jqueue.py index 8e43c903b..cbf43df88 100644 --- a/lib/jqueue.py +++ b/lib/jqueue.py @@ -377,6 +377,16 @@ class JobQueue(object): # TODO: check failed_nodes + def _RenameFileUnlocked(self, old, new): + os.rename(old, new) + + result = rpc.call_jobqueue_rename(self._nodes, old, new) + for node in self._nodes: + if not result[node]: + logging.error("Moving %s to %s failed on %s", old, new, node) + + # TODO: check failed nodes + def _FormatJobID(self, job_id): if not isinstance(job_id, (int, long)): raise errors.ProgrammerError("Job ID '%s' not numeric" % job_id) @@ -577,7 +587,7 @@ class JobQueue(object): old = self._GetJobPath(job.id) new = self._GetArchivedJobPath(job.id) - os.rename(old, new) + self._RenameFileUnlocked(old, new) logging.debug("Successfully archived job %s", job.id) finally: -- GitLab