slurm_config
Submodule to handle the SLURM configuration for a WorkflowTask
SlurmConfig
¶
Bases: BaseModel
Abstraction for SLURM parameters
NOTE: SlurmConfig
objects are created internally in fractal-server
,
and they are not meant to be initialized by the user; the same holds for
SlurmConfig
attributes (e.g. mem_per_task_MB
), which are not meant to
be part of the superuser-defined resource.jobs_runner_config
JSON field.
Part of the attributes map directly to some of the SLURM attributes (see
https://slurm.schedmd.com/sbatch.html), e.g. partition
. Other attributes
are metaparameters which are needed in fractal-server to combine multiple
tasks in the same SLURM job (e.g. parallel_tasks_per_job
or
max_num_jobs
).
Attributes:
Name | Type | Description |
---|---|---|
partition |
str
|
Corresponds to SLURM option. |
cpus_per_task |
int
|
Corresponds to SLURM option. |
mem_per_task_MB |
int
|
Corresponds to |
job_name |
str | None
|
Corresponds to |
constraint |
str | None
|
Corresponds to SLURM option. |
gres |
str | None
|
Corresponds to SLURM option. |
account |
str | None
|
Corresponds to SLURM option. |
gpus |
str | None
|
Corresponds to SLURM option. |
time |
str | None
|
Corresponds to SLURM option (WARNING: not fully supported). |
nodelist |
str | None
|
Corresponds to SLURM option. |
exclude |
str | None
|
Corresponds to SLURM option. |
prefix |
str
|
Prefix of configuration lines in SLURM submission scripts. |
shebang_line |
str
|
Shebang line for SLURM submission scripts. |
extra_lines |
list[str] | None
|
Additional lines to include in SLURM submission scripts. |
tasks_per_job |
int | None
|
Number of tasks for each SLURM job. |
parallel_tasks_per_job |
int | None
|
Number of tasks to run in parallel for each SLURM job. |
target_cpus_per_job |
int
|
Optimal number of CPUs to be requested in each SLURM job. |
max_cpus_per_job |
int
|
Maximum number of CPUs that can be requested in each SLURM job. |
target_mem_per_job |
int
|
Optimal amount of memory (in MB) to be requested in each SLURM job. |
max_mem_per_job |
int
|
Maximum amount of memory (in MB) that can be requested in each SLURM job. |
target_num_jobs |
int
|
Optimal number of SLURM jobs for a given WorkflowTask. |
max_num_jobs |
int
|
Maximum number of SLURM jobs for a given WorkflowTask. |
user_local_exports |
dict[str, str] | None
|
Key-value pairs to be included as |
Source code in fractal_server/runner/executors/slurm_common/slurm_config.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
|
_sorted_extra_lines()
¶
Return a copy of self.extra_lines
, where lines starting with
self.prefix
are listed first.
Source code in fractal_server/runner/executors/slurm_common/slurm_config.py
101 102 103 104 105 106 107 108 109 110 111 112 113 |
|
sort_script_lines(script_lines)
¶
Return a copy of script_lines
, where lines are sorted as in:
self.shebang_line
(if present);- Lines starting with
self.prefix
; - Other lines.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
script_lines
|
list[str]
|
|
required |
Source code in fractal_server/runner/executors/slurm_common/slurm_config.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
to_sbatch_preamble(remote_export_dir=None)
¶
Compile SlurmConfig
object into the preamble of a SLURM submission
script.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
remote_export_dir
|
str | None
|
Base directory for exports defined in
|
None
|
Source code in fractal_server/runner/executors/slurm_common/slurm_config.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
|