Skip to content

Commit b013122

Browse files
authored
add extra_scheduler to slurm_run (#202)
* add `extra_scheduler` to `slurm_run` * better doc-string
1 parent f005e7b commit b013122

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

adaptive_scheduler/_scheduler/slurm.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ class SLURM(BaseScheduler):
9393
``NUMEXPR_NUM_THREADS`` will be set to this number.
9494
extra_scheduler
9595
Extra ``#SLURM`` (depending on scheduler type)
96-
arguments, e.g. ``["--exclusive=user", "--time=1"]``.
96+
arguments, e.g. ``["--exclusive=user", "--time=1"]`` or a tuple of lists,
97+
e.g. ``(["--time=10"], ["--time=20"]])`` for two jobs.
9798
extra_env_vars
9899
Extra environment variables that are exported in the job
99100
script. e.g. ``["TMPDIR='/scratch'", "PYTHONPATH='my_dir:$PYTHONPATH'"]``.

adaptive_scheduler/_server_support/slurm_run.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def slurm_run(
3535
max_simultaneous_jobs: int = 100,
3636
exclusive: bool = True,
3737
executor_type: EXECUTOR_TYPES = "process-pool",
38+
extra_scheduler: list[str] | tuple[list[str], ...] | None = None,
3839
extra_run_manager_kwargs: dict[str, Any] | None = None,
3940
extra_scheduler_kwargs: dict[str, Any] | None = None,
4041
initializers: list[Callable[[], None]] | None = None,
@@ -93,17 +94,22 @@ def slurm_run(
9394
"loky", or "process-pool".
9495
exclusive
9596
Whether to use exclusive nodes, adds ``"--exclusive"`` if True.
97+
extra_scheduler
98+
Extra ``#SLURM`` (depending on scheduler type)
99+
arguments, e.g. ``["--exclusive=user", "--time=1"]`` or a tuple of lists,
100+
e.g. ``(["--time=10"], ["--time=20"]])`` for two jobs.
96101
extra_run_manager_kwargs
97102
Extra keyword arguments to pass to the `RunManager`.
98103
extra_scheduler_kwargs
99-
Extra keyword arguments to pass to the `SLURMScheduler`.
104+
Extra keyword arguments to pass to the `adaptive_scheduler.scheduler.SLURM`.
100105
initializers
101106
List of functions that are called before the job starts, can populate
102107
a cache.
103108
104109
Returns
105110
-------
106111
RunManager
112+
107113
"""
108114
if partition is None:
109115
partitions = slurm_partitions()
@@ -143,6 +149,7 @@ def slurm_run(
143149
executor_type=executor_type,
144150
num_threads=num_threads,
145151
exclusive=exclusive,
152+
extra_scheduler=extra_scheduler,
146153
**(extra_scheduler_kwargs or {}),
147154
)
148155
scheduler = SLURM(**slurm_kwargs)

0 commit comments

Comments
 (0)