With 2.12 jobs run as separate processes. Therefore,
each process should only be in charge of a single
job. Keep track of its job id and warn if this property
is violated.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 lib/jqueue/__init__.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/jqueue/__init__.py b/lib/jqueue/__init__.py
index df66d94..48b16e7 100644
--- a/lib/jqueue/__init__.py
+++ b/lib/jqueue/__init__.py
@@ -1397,6 +1397,7 @@ class JobQueue(object):
         data and other ganeti objects
 
     """
+    self.primary_jid = None
     self.context = context
     self._memcache = weakref.WeakValueDictionary()
     self._my_hostname = netutils.Hostname.GetSysName()
@@ -1443,6 +1444,12 @@ class JobQueue(object):
     Pick up a job that already is in the job queue and start/resume it.
 
     """
+    if self.primary_jid:
+      logging.warning("Job process asked to pick up %s, but already has %s",
+                      job_id, self.primary_jid)
+
+    self.primary_jid = int(job_id)
+
     job = self._LoadJobUnlocked(job_id)
 
     if job is None:
-- 
2.2.0.rc0.207.ga3a616c

Reply via email to