diff --git a/src/xfel_calibrate/calibrate.py b/src/xfel_calibrate/calibrate.py index 26e45f0fe1e7e439f85a166bb92c8e97df86a27b..089a6ed2a68607d42ee8c999d3a44defecbf18b2 100755 --- a/src/xfel_calibrate/calibrate.py +++ b/src/xfel_calibrate/calibrate.py @@ -35,13 +35,8 @@ from .nb_args import ( from .settings import ( default_report_path, finalize_time_limit, - free_nodes_cmd, launcher_command, - max_reserved, - preempt_nodes_cmd, python_path, - reservation, - reservation_char, sprof, temp_path, try_report_to_output, @@ -276,36 +271,22 @@ def save_executed_command(run_tmp_path, version, argv): class SlurmOptions: def __init__( self, job_name=None, nice=None, mem=None, partition=None, reservation=None, - priority_group=2, ): self.job_name = job_name or 'xfel_calibrate' self.nice = nice self.mem = mem self.partition = partition self.reservation = reservation - self.priority_group = priority_group def get_partition_or_reservation(self) -> List[str]: """Return sbatch arguments to use a partition or reservation --reservation and --slurm-partition options have precedence. - Otherwise, if --priority is <=1, it will use a configured reservation - depending on how many nodes are currently free. + Otherwise, a default partition is used. """ if self.reservation: return ['--reservation', self.reservation] - elif self.partition: - return ['--partition', self.partition] - elif self.priority_group <= 1: - auto_resvn = reservation_char if self.priority_group <= 0 else reservation - # Use a reservation if there aren't many general nodes available to us - free = int(check_output(free_nodes_cmd, shell=True).decode('utf8')) - preempt = int(check_output(preempt_nodes_cmd, shell=True).decode('utf8')) - if free + preempt < max_reserved: - return ['--reservation', auto_resvn] - - # Fallback to using the configured partition (default: exfel) - return ['--partition', sprof] + return ['--partition', self.partition or sprof] def get_launcher_command(self, temp_path, after_ok=(), after_any=()) -> List[str]: """ @@ -836,7 +817,6 @@ def run(argv=None): mem=args['slurm_mem'], reservation=args['reservation'], partition=args['slurm_partition'], - priority_group=args['priority'], )) errors = False diff --git a/src/xfel_calibrate/nb_args.py b/src/xfel_calibrate/nb_args.py index 511223ed69462c5cab82ad87025d9a848481c9b6..edf893e003450370d1010fc81f8f9062246df19e 100644 --- a/src/xfel_calibrate/nb_args.py +++ b/src/xfel_calibrate/nb_args.py @@ -77,10 +77,6 @@ def make_initial_parser(**kwargs): "retrieved-constants will be copied to use for a new correction." )) - parser.add_argument('--priority', type=int, default=2, - help="Priority of batch jobs. If priority<=1, reserved" - " nodes become available.") - parser.add_argument('--vector-figs', action="store_true", default=False, help="Use vector graphics for figures in the report.") diff --git a/tests/test_xfel_calibrate/conftest.py b/tests/test_xfel_calibrate/conftest.py index 95bc80f2e7fb0e71bbae94921df10514bc26c658..7533d2f278397fc234f2c780aebdfc217622ade2 100644 --- a/tests/test_xfel_calibrate/conftest.py +++ b/tests/test_xfel_calibrate/conftest.py @@ -35,8 +35,6 @@ class FakeProcessCalibrate(FakeProcess): """ super().__init__() # Fake calls to slurm - self.register_subprocess(settings.free_nodes_cmd, stdout=["1"]) - self.register_subprocess(settings.preempt_nodes_cmd, stdout=["1"]) self.register_subprocess( ["sbatch", self.any()], stdout=["000000"] )