This number will always be only 0 or 1, but keep the implementation generic. We need to know whether the job is currently in the execution phase to decide if we can clean up ourselves on disappearance or our job file.
Signed-off-by: Klaus Aehlig <[email protected]> --- lib/mcpu.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/mcpu.py b/lib/mcpu.py index 7446bc1..72f13bf 100644 --- a/lib/mcpu.py +++ b/lib/mcpu.py @@ -57,6 +57,7 @@ from ganeti import wconfd sighupReceived = [False] +lusExecuting = [0] _OP_PREFIX = "Op" _LU_PREFIX = "LU" @@ -508,6 +509,7 @@ class Processor(object): else: submit_mj_fn = _FailingSubmitManyJobs + lusExecuting[0] += 1 try: result = _ProcessResult(submit_mj_fn, lu.op, lu.Exec(self.Log)) h_results = hm.RunPhase(constants.HOOKS_PHASE_POST) @@ -515,6 +517,7 @@ class Processor(object): self.Log, result) finally: # FIXME: This needs locks if not lu_class.REQ_BGL + lusExecuting[0] -= 1 if write_count != self.cfg.write_count: hm.RunConfigUpdate() -- 2.2.0.rc0.207.ga3a616c
