Skip to content

Commit d4e0a0f

Browse files
cmeestersfgvieira
andauthored
feat: adding reservation flag (#323)
This PR adds a `--reservation` flag. Usually, for teaching, we recommend relying on SLURM's `magnetic` flag. This way, users will not need to specify a reservation. However, not all reservations can be made magnetic nor for all courses. Hence, the introduction of a new flag. Supersedes PR #285 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added support for specifying a SLURM reservation when submitting jobs, allowing users to include a reservation string during job submission. - **Documentation** - Added a section explaining how to use SLURM reservations, including usage recommendations and best practices for teaching or testing scenarios. - Included details about the `--slurm-reservation` flag and noted that reservation validation and eligibility checks are not performed by the plugin. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Filipe G. Vieira <1151762+fgvieira@users.noreply.github.com>
1 parent ec82a70 commit d4e0a0f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

docs/further.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,11 @@ This configuration directs SLURM logs to a centralized location, making them eas
618618
Running Snakemake within an active SLURM job can lead to unpredictable behavior, as the execution environment may not be properly configured for job submission.
619619
To mitigate potential issues, the SLURM executor plugin detects when it's operating inside a SLURM job and issues a warning, pausing for 5 seconds before proceeding.
620620

621+
### Submittings Jobs into SLURM reservations
622+
623+
The plugin allows specifying a flag `--slurm-reservation=<name>` to use a particular reservation.
624+
It does not validate the spelling nor eligibility to this reservation.
625+
621626
### Frequently Asked Questions
622627

623628
#### Should I run Snakemake on the Login Node of my Cluster?

snakemake_executor_plugin_slurm/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ class ExecutorSettings(ExecutorSettingsBase):
106106
"required": False,
107107
},
108108
)
109+
reservation: Optional[str] = field(
110+
default=None,
111+
metadata={
112+
"help": "If set, the given reservation will be used for job submission.",
113+
"env_var": False,
114+
"required": False,
115+
},
116+
)
109117

110118

111119
# Required:
@@ -245,6 +253,9 @@ def run_job(self, job: JobExecutorInterface):
245253
if self.workflow.executor_settings.requeue:
246254
call += " --requeue"
247255

256+
if self.workflow.executor_settings.reservation:
257+
call += f" --reservation={self.workflow.executor_settings.reservation}"
258+
248259
call += set_gres_string(job)
249260

250261
if not job.resources.get("runtime"):

0 commit comments

Comments
 (0)