From f8a761cd8d77348be2a49c70ced2015d83b3de3d Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Tue, 19 Jul 2016 07:31:17 +0000
Subject: [PATCH] Task #9683: fixed race condition. set status to queue before
 we hand over the control of the pipeline to slurm

---
 MAC/Services/src/PipelineControl.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MAC/Services/src/PipelineControl.py b/MAC/Services/src/PipelineControl.py
index 74d5d04f40b..95e265bd310 100755
--- a/MAC/Services/src/PipelineControl.py
+++ b/MAC/Services/src/PipelineControl.py
@@ -437,6 +437,9 @@ class PipelineControl(OTDBBusListener):
         status_bus = self.otdb_service_busname,
       ))
 
+    logger.info("Handing over pipeline %s to SLURM, setting status to QUEUED", otdbId)
+    self._setStatus(otdbId, "queued")
+
     # Schedule runPipeline.sh
     logger.info("Scheduling SLURM job for runPipeline.sh")
     slurm_job_id = self.slurm.submit(self._jobName(otdbId),
@@ -558,9 +561,6 @@ wget -O - -q "http://ganglia.control.lofar/ganglia/api/events.php?action=add&sta
     )
     logger.info("Scheduled SLURM job %s", slurm_cancel_job_id)
 
-    logger.info("Setting status to QUEUED")
-    self._setStatus(otdbId, "queued")
-
   def _stopPipeline(self, otdbId):
     # Cancel corresponding SLURM job, but first the abort-trigger
     # to avoid setting ABORTED as a side effect.
-- 
GitLab