From 92b0fff6f0970f3747206f278816295ee1875af2 Mon Sep 17 00:00:00 2001
From: Steffen Hauf <haufs@max-exfl015.desy.de>
Date: Thu, 28 Jun 2018 13:32:41 +0200
Subject: [PATCH] Make the cluster launch command configurable

---
 docs/source/configuration.rst | 4 ++--
 xfel_calibrate/calibrate.py   | 4 +---
 xfel_calibrate/settings.py    | 4 ++--
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst
index 5d7fc8eac..a618c2414 100644
--- a/docs/source/configuration.rst
+++ b/docs/source/configuration.rst
@@ -38,8 +38,8 @@ python file of the form::
     # Also try to output the report to an out_folder defined by the notebook
     try_report_to_output = True
 
-    # The SLURM partition to use
-    slurm_partion = "exfel"
+    # the command to run this concurrently. It is prepended to the actual call
+    launcher_command = "sbatch -p exfel -t 24:00:00 --mem 500G --mail-type END --requeue --output {temp_path}/slurm-%j.out"
     
 A comment is given for the meaning of each configuration parameter.
 
diff --git a/xfel_calibrate/calibrate.py b/xfel_calibrate/calibrate.py
index c5d7f673b..c4e7335d9 100755
--- a/xfel_calibrate/calibrate.py
+++ b/xfel_calibrate/calibrate.py
@@ -269,9 +269,7 @@ def concurrent_run(temp_path, nb, nbname, args, cparm=None, cval=None,
         os.chmod("{}/finalize.sh".format(temp_path), all_stats)
     # then run an sbatch job
     if not sequential:
-        srun_base = ["sbatch", "-p", slurm_partion, "-t", "24:00:00",
-                     "--mem", "500G", "--mail-type", "END", "--requeue",
-                     "--output", "{}/slurm-%j.out".format(temp_path)]
+        srun_base = launcher_command.format(temp_path=temp_path).split()
     else:
         srun_base = []
         
diff --git a/xfel_calibrate/settings.py b/xfel_calibrate/settings.py
index 01c32cd70..df716b905 100644
--- a/xfel_calibrate/settings.py
+++ b/xfel_calibrate/settings.py
@@ -24,5 +24,5 @@ report_path = "{}/calibration_reports/".format(os.getcwd())
 # Also try to output the report to an out_folder defined by the notebook
 try_report_to_output = True
 
-# The SLURM partition to use
-slurm_partion = "exfel"
\ No newline at end of file
+# the command to run this concurrently. It is prepended to the actual call
+launcher_command = "sbatch -p exfel -t 24:00:00 --mem 500G --mail-type END --requeue --output {temp_path}/slurm-%j.out"
\ No newline at end of file
-- 
GitLab