From d36201df81184b9a995179eb9edd33d8f286e9be Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Fri, 25 Mar 2016 12:49:09 +0000
Subject: [PATCH] Task #8437: Provide SLURM partition name when scheduling
 jobs, to prevent scheduling to wrong partition

---
 MAC/Services/src/PipelineControl.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/MAC/Services/src/PipelineControl.py b/MAC/Services/src/PipelineControl.py
index 06dc9ee314b..93d575236d1 100755
--- a/MAC/Services/src/PipelineControl.py
+++ b/MAC/Services/src/PipelineControl.py
@@ -136,6 +136,9 @@ class Slurm(object):
   def __init__(self, headnode="head01.cep4"):
     self.headnode = headnode
 
+    # TODO: Derive SLURM partition name
+    self.partition = "cpu"
+
   def _runCommand(self, cmdline):
     cmdline = "ssh %s %s" % (self.headnode, cmdline)
     runCommand(cmdline)
@@ -144,7 +147,7 @@ class Slurm(object):
     if sbatch_params is None:
       sbatch_params = []
 
-    stdout = self._runCommand("sbatch --job-name=%s %s bash -c '%s'" % (jobName, " ".join(sbatch_params), cmdline))
+    stdout = self._runCommand("sbatch --partition=%s --job-name=%s %s bash -c '%s'" % (self.partition, jobName, " ".join(sbatch_params), cmdline))
 
     # Returns "Submitted batch job 3" -- extract ID
     match = re.search("Submitted batch job (\d+)", stdout)
-- 
GitLab