Skip to content

Commit 46fc2bd

Browse files
committed
Merge branch 'slurm_reservation' into dev
Conflicts: batchspawner/batchspawner.py batchspawner/tests/test_spawners.py
2 parents 8633785 + 81ff85a commit 46fc2bd

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

batchspawner/batchspawner.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@ class SlurmSpawner(UserEnvMixin,BatchSpawnerRegexStates):
539539
{% endif %}{% if runtime %}#SBATCH --time={{runtime}}
540540
{% endif %}{% if memory %}#SBATCH --mem={{memory}}
541541
{% endif %}{% if nprocs %}#SBATCH --cpus-per-task={{nprocs}}
542+
{% endif %}{% if reservation%}#SBATCH --reservation={{reservation}}
542543
{% endif %}{% if options %}#SBATCH {{options}}{% endif %}
543544
544545
trap 'echo SIGTERM received' TERM
@@ -563,6 +564,10 @@ class SlurmSpawner(UserEnvMixin,BatchSpawnerRegexStates):
563564
"to run in job step (affects environment handling)"
564565
).tag(config=True)
565566

567+
req_reservation = Unicode('', \
568+
help="Reservation name to submit to resource manager"
569+
).tag(config=True)
570+
566571
# outputs line like "Submitted batch job 209"
567572
batch_submit_cmd = Unicode('sbatch --parsable').tag(config=True)
568573
# outputs status and exec node like "RUNNING hostname"

batchspawner/tests/test_spawners.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,14 @@ def test_slurm(db, io_loop):
338338
'req_options': 'some_option_asdf',
339339
'req_prologue': 'PROLOGUE',
340340
'req_epilogue': 'EPILOGUE',
341+
'req_reservation': 'RES123',
341342
}
342343
batch_script_re_list = [
343344
re.compile(r'PROLOGUE.*srun singleuser_command.*EPILOGUE', re.S),
344345
re.compile(r'^#SBATCH \s+ --cpus-per-task=5', re.X|re.M),
345346
re.compile(r'^#SBATCH \s+ --time=3-05:10:10', re.X|re.M),
346347
re.compile(r'^#SBATCH \s+ some_option_asdf', re.X|re.M),
348+
re.compile(r'^#SBATCH \s+ --reservation=RES123', re.X|re.M),
347349
]
348350
from .. import SlurmSpawner
349351
run_spawner_script(db, io_loop, SlurmSpawner, normal_slurm_script,

0 commit comments

Comments
 (0)