From cc4eec7ecb3d365d409e6cd2755693790fb60aff Mon Sep 17 00:00:00 2001
From: ahmedk <karim.ahmed@xfel.eu>
Date: Thu, 25 Nov 2021 13:12:39 +0100
Subject: [PATCH] avoid using dedicated partition for reports

---
 src/xfel_calibrate/calibrate.py   | 7 ++++---
 src/xfel_calibrate/nb_args.py     | 3 ---
 src/xfel_calibrate/repeat.py      | 1 +
 webservice/config/webservice.yaml | 2 --
 4 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/xfel_calibrate/calibrate.py b/src/xfel_calibrate/calibrate.py
index 4a2f521ef..8bb0d6357 100755
--- a/src/xfel_calibrate/calibrate.py
+++ b/src/xfel_calibrate/calibrate.py
@@ -225,7 +225,8 @@ def create_finalize_script(fmt_args, temp_path, job_list) -> str:
     return f_name
 
 
-def run_finalize(fmt_args, temp_path, job_list, sequential=False):
+def run_finalize(
+    fmt_args, temp_path, job_list, sequential=False, partition="exfel"):
     finalize_script = create_finalize_script(fmt_args, temp_path, job_list)
 
     cmd = []
@@ -238,7 +239,7 @@ def run_finalize(fmt_args, temp_path, job_list, sequential=False):
             '--open-mode=append',  # So we can see if it's preempted & requeued
             '--job-name', 'xfel-cal-finalize',
             '--time', finalize_time_limit,
-            '--partition', fmt_args['report_partition'],
+            '--partition', partition,
             "--dependency=afterany:" + ":".join(str(j) for j in job_list),
         ]
         print(" ".join(cmd))
@@ -849,7 +850,6 @@ def run(argv=None):
                 'in_folder': folder,
                 'request_time': request_time,
                 'submission_time': submission_time,
-                'report_partition': args['report_slurm_partition'],
                 }
 
     joblist.append(run_finalize(
@@ -857,6 +857,7 @@ def run(argv=None):
         temp_path=run_tmp_path,
         job_list=joblist,
         sequential=args["no_cluster_job"],
+        partition=args["slurm_partition"] if args["slurm_partition"] else "exfel",  # noqa
     ))
 
     if any(j is not None for j in joblist):
diff --git a/src/xfel_calibrate/nb_args.py b/src/xfel_calibrate/nb_args.py
index 33ccc931e..511223ed6 100644
--- a/src/xfel_calibrate/nb_args.py
+++ b/src/xfel_calibrate/nb_args.py
@@ -103,9 +103,6 @@ def make_initial_parser(**kwargs):
     parser.add_argument('--slurm-partition', type=str, default="",
                         help="Submit jobs in this Slurm partition")
 
-    parser.add_argument('--report-slurm-partition', type=str, default="exfel",
-                        help="Submit jobs in this Slurm partition")
-
     parser.add_argument('--reservation', type=str, default="",
                         help="Submit jobs in this Slurm reservation, "
                              "overriding --slurm-partition if both are set")
diff --git a/src/xfel_calibrate/repeat.py b/src/xfel_calibrate/repeat.py
index 95d41b171..12d4b3005 100644
--- a/src/xfel_calibrate/repeat.py
+++ b/src/xfel_calibrate/repeat.py
@@ -93,6 +93,7 @@ def main(argv=None):
         temp_path=working_dir,
         job_list=joblist,
         sequential=args.no_cluster_job,
+        partition=args.slurm_partition
     ))
 
     if any(j is not None for j in joblist):
diff --git a/webservice/config/webservice.yaml b/webservice/config/webservice.yaml
index 7d83e8d1e..26d74e07c 100644
--- a/webservice/config/webservice.yaml
+++ b/webservice/config/webservice.yaml
@@ -36,7 +36,6 @@ correct:
         python -m xfel_calibrate.calibrate {detector} CORRECT
         --slurm-scheduling {sched_prio}
         --slurm-partition upex-middle
-        --report-slurm-partition upex-middle
         --request-time {request_time}
         --slurm-name {action}_{instrument}_{detector}_{cycle}_p{proposal}_{runs}
         --report-to /gpfs/exfel/exp/{instrument}/{cycle}/p{proposal}/usr/Reports/{runs}/{det_instance}_{action}_{proposal}_{runs}_{time_stamp}
@@ -52,7 +51,6 @@ dark:
         --concurrency-par karabo_da
         --slurm-scheduling {sched_prio}
         --slurm-partition upex-high
-        --report-slurm-partition upex-middle
         --request-time {request_time}
         --slurm-name {action}_{instrument}_{detector}_{cycle}_p{proposal}_{runs}
         --report-to /gpfs/exfel/d/cal/caldb_store/xfel/reports/{instrument}/{det_instance}/{action}/{action}_{proposal}_{runs}_{time_stamp}
-- 
GitLab