Skip to content

Commit 42471d8

Browse files
authored
some more improvements (#291)
* set light/dark mode primary colors explicitly * Reuse logic to get the batch script of a job from the new Job API * improve job submit testing and fix bugs * JobSubmitDescription: fix some docstrings * change quality_of_service to just qos in pyslurm/db/job * fix date parse tests?
1 parent 788f445 commit 42471d8

File tree

11 files changed

+599
-529
lines changed

11 files changed

+599
-529
lines changed

mkdocs.yml

+2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ theme:
2020
- media: "(prefers-color-scheme: light)"
2121
scheme: default
2222
accent: purple
23+
primary: indigo
2324
toggle:
2425
icon: material/brightness-7
2526
name: Switch to dark mode
2627
- media: "(prefers-color-scheme: dark)"
2728
scheme: slate
2829
accent: lime
30+
primary: black
2931
toggle:
3032
icon: material/brightness-4
3133
name: Switch to light mode

pyslurm/core/job/submission.pxd

+69-60
Original file line numberDiff line numberDiff line change
@@ -108,26 +108,25 @@ cdef class JobSubmitDescription:
108108
cpu_frequency (Union[dict, str]):
109109
CPU Frequency for the Job, same as --cpu-freq from sbatch.
110110
111-
Examples:
112-
Specifying it as a dict:
111+
For example, specifying it as a dict:
113112
114113
cpu_frequency = {
115114
"min": "Low",
116115
"max": "High",
117116
"governor": "UserSpace"
118117
}
119118
120-
or like in sbatch with a string. For more info on that, check
121-
out the sbatch documentation for --cpu-freq.
119+
or like in sbatch with a string. For more info on that, check
120+
out the sbatch documentation for --cpu-freq.
122121
123-
If you only want to set a Governor without any min or max, you
124-
can simply specify it as a standalone string:
122+
If you only want to set a Governor without any min or max, you
123+
can simply specify it as a standalone string:
125124
126125
cpu_frequency = "Performance"
127126
or
128127
cpu_frequency = {"governor": "Performance"}
129128
130-
If you want to set a specific, fixed frequency, you can do:
129+
If you want to set a specific, fixed frequency, you can do:
131130
132131
cpu_frequency = <frequency in kilohertz>
133132
or either
@@ -136,21 +135,19 @@ cdef class JobSubmitDescription:
136135
Amount of nodes needed for the job.
137136
This is the same as -N/--nodes from sbatch.
138137
139-
Examples:
140-
Providing min/max nodes as a dict:
138+
For example, providing min/max nodes as a dict:
141139
142140
nodes = {
143141
"min": 3,
144142
"max": 6
145143
}
146144
147-
When no range is needed, you can also simply specify it as
148-
int:
145+
When no range is needed, you can also simply specify it as int:
149146
150147
nodes = 3
151148
152-
Other than that, a range can also be specified in a str like
153-
with sbatch:
149+
Other than that, a range can also be specified in a str like with
150+
sbatch:
154151
155152
nodes = "1-5"
156153
deadline (str):
@@ -193,7 +190,9 @@ cdef class JobSubmitDescription:
193190
This is the same as --mem-per-cpu from sbatch. This is mutually
194191
exclusive with memory_per_node and memory_per_gpu.
195192
193+
196194
Examples:
195+
197196
# 1 MiB
198197
memory_per_cpu = 1024
199198
@@ -207,7 +206,9 @@ cdef class JobSubmitDescription:
207206
This is the same as --mem from sbatch. This is mutually exclusive
208207
with memory_per_cpu and memory_per_gpu.
209208
209+
210210
Examples:
211+
211212
# 1 MiB
212213
memory_per_node = 1024
213214
@@ -221,7 +222,9 @@ cdef class JobSubmitDescription:
221222
This is the same as --mem-per-gpu from sbatch. This is mutually
222223
exclusive with memory_per_node and memory_per_cpu.
223224
225+
224226
Examples:
227+
225228
# 1 MiB
226229
memory_per_gpu = 1024
227230
@@ -235,12 +238,13 @@ cdef class JobSubmitDescription:
235238
This is the same as --nice from sbatch.
236239
log_files_open_mode (str):
237240
Mode in which standard_output and standard_error log files should be opened.
241+
This is the same as --open-mode from sbatch.
242+
238243
239244
Valid options are:
240-
* append
241-
* truncate
242245
243-
This is the same as --open-mode from sbatch.
246+
* `append`
247+
* `truncate`
244248
overcommit (bool):
245249
If the resources should be overcommitted.
246250
This is the same as -O/--overcommit from sbatch.
@@ -254,15 +258,15 @@ cdef class JobSubmitDescription:
254258
Interval for accounting info to be gathered.
255259
This is the same as --acctg-freq from sbatch.
256260
257-
Examples:
258-
Specifying it as a dict:
261+
262+
For example, specifying it as a dict:
259263
260264
accounting_gather_frequency = {
261-
energy=60,
262-
network=20,
265+
"energy"=60,
266+
"network"=20,
263267
}
264268
265-
or as a single string:
269+
or as a single string:
266270
267271
accounting_gather_frequency = "energy=60,network=20"
268272
qos (str):
@@ -283,34 +287,38 @@ cdef class JobSubmitDescription:
283287
You can specify either a path to a script which will be loaded, or
284288
you can pass the script as a string.
285289
If the script is passed as a string, providing arguments to it
286-
(see "script_args") is not supported.
290+
(see `script_args`) is not supported.
287291
script_args (str):
288292
Arguments passed to the batch script.
289293
You can only set arguments if a file path was specified for
290-
"script".
294+
`script`.
291295
environment (Union[dict, str]):
292296
Environment variables to be set for the Job.
293297
This is the same as --export from sbatch.
294298
resource_sharing (str):
295299
Controls the resource sharing with other Jobs.
296-
297300
This property combines functionality of --oversubscribe and
298301
--exclusive from sbatch.
299302
303+
300304
Allowed values are are:
301305
302-
* "oversubscribe" or "yes":
306+
* `oversubscribe` or `yes`:
307+
303308
The Job allows resources to be shared with other running Jobs.
304309
305-
* "user"
310+
* `user`:
311+
306312
Only sharing resources with other Jobs that have the "user"
307313
option set is allowed
308314
309-
* "mcs"
315+
* `mcs`:
316+
310317
Only sharing resources with other Jobs that have the "mcs"
311318
option set is allowed.
312319
313-
* "no" or "exclusive"
320+
* `no` or `exclusive`:
321+
314322
No sharing of resources is allowed. (--exclusive from sbatch)
315323
distribution (str):
316324
Task distribution for the Job, same as --distribution from sbatch
@@ -327,12 +335,12 @@ cdef class JobSubmitDescription:
327335
The amount of cpus required for each task.
328336
329337
This is the same as -c/--cpus-per-task from sbatch.
330-
This is mutually exclusive with cpus_per_gpu.
338+
This is mutually exclusive with `cpus_per_gpu`.
331339
cpus_per_gpu (int):
332340
The amount of cpus required for each allocated GPU.
333341
334342
This is the same as --cpus-per-gpu from sbatch.
335-
This is mutually exclusive with cpus_per_task.
343+
This is mutually exclusive with `cpus_per_task`.
336344
sockets_per_node (int):
337345
Restrict Job to nodes with atleast this many sockets.
338346
This is the same as --sockets-per-node from sbatch.
@@ -344,23 +352,22 @@ cdef class JobSubmitDescription:
344352
This is the same as --threads-per-core from sbatch.
345353
gpus (Union[dict, str, int]):
346354
GPUs for the Job to be allocated in total.
347-
348355
This is the same as -G/--gpus from sbatch.
349356
Specifying the type of the GPU is optional.
350357
351-
Examples:
352-
Specifying the GPU counts as a dict:
358+
359+
For example, specifying the GPU counts as a dict:
353360
354361
gpus = {
355362
"tesla": 1,
356363
"volta": 5,
357364
}
358365
359-
Or, for example, in string format:
366+
Or, for example, in string format:
360367
361368
gpus = "tesla:1,volta:5"
362369
363-
Or, if you don't care about the type of the GPU:
370+
Or, if you don't care about the type of the GPU:
364371
365372
gpus = 6
366373
gpus_per_socket (Union[dict, str, int]):
@@ -369,21 +376,21 @@ cdef class JobSubmitDescription:
369376
This is the same as --gpus-per-socket from sbatch.
370377
371378
Specifying the type of the GPU is optional. Note that setting
372-
gpus_per_socket requires to also specify sockets_per_node.
379+
`gpus_per_socket` requires to also specify sockets_per_node.
373380
374-
Examples:
375-
Specifying it as a dict:
381+
382+
For example, specifying it as a dict:
376383
377384
gpus_per_socket = {
378385
"tesla": 1,
379386
"volta": 5,
380387
}
381388
382-
Or, for example, in string format:
389+
Or, for example, in string format:
383390
384391
gpus_per_socket = "tesla:1,volta:5"
385392
386-
Or, if you don't care about the type of the GPU:
393+
Or, if you don't care about the type of the GPU:
387394
388395
gpus_per_socket = 6
389396
gpus_per_task (Union[dict, str, int]):
@@ -392,22 +399,21 @@ cdef class JobSubmitDescription:
392399
This is the same as --gpus-per-task from sbatch.
393400
394401
Specifying the type of the GPU is optional. Note that setting
395-
"gpus_per_task" requires to also specify either one of "ntasks" or
396-
"gpus".
402+
`gpus_per_task` requires to also specify either one of `ntasks` or
403+
`gpus`.
397404
398-
Examples:
399-
Specifying it as a dict:
405+
For example, specifying it as a dict:
400406
401407
gpus_per_task = {
402408
"tesla": 1,
403409
"volta": 5,
404410
}
405411
406-
Or, for example, in string format:
412+
Or, for example, in string format:
407413
408414
gpus_per_task = "tesla:1,volta:5"
409415
410-
Or, if you don't care about the type of the GPU:
416+
Or, if you don't care about the type of the GPU:
411417
412418
gpus_per_task = 6
413419
gres_per_node (Union[dict, str]):
@@ -418,19 +424,18 @@ cdef class JobSubmitDescription:
418424
Specifying the type (by seperating GRES name and type with a
419425
semicolon) is optional.
420426
421-
Examples:
422-
Specifying it as a dict:
427+
For example, specifying it as a dict:
423428
424429
gres_per_node = {
425430
"gpu:tesla": 1,
426431
"gpu:volta": 5,
427432
}
428433
429-
Or, for example, in string format:
434+
Or, for example, in string format:
430435
431436
gres_per_node = "gpu:tesla:1,gpu:volta:5"
432437
433-
GPU Gres without a specific type:
438+
GPU Gres without a specific type:
434439
435440
gres_per_node = "gpu:6"
436441
gpu_binding (str):
@@ -458,12 +463,12 @@ cdef class JobSubmitDescription:
458463
switches.
459464
This is the same as --switches from sbatch.
460465
461-
Examples:
462-
Specifying it as a dict:
466+
467+
For example, specifying it as a dict:
463468
464469
switches = { "count": 5, "max_wait_time": "00:10:00" }
465470
466-
Or as a single string (sbatch-style):
471+
Or as a single string (sbatch-style):
467472
468473
switches = "5@00:10:00"
469474
signal (Union[dict, str]):
@@ -473,18 +478,18 @@ cdef class JobSubmitDescription:
473478
The signal can both be specified with its name, e.g. "SIGKILL", or
474479
as a number, e.g. 9
475480
476-
Examples:
477-
Specifying it as a dict:
481+
482+
For example, specifying it as a dict:
478483
479484
signal = {
480485
"signal": "SIGKILL",
481486
"time": 120
482487
}
483488
484-
The above will send a "SIGKILL" signal 120 seconds before the
485-
Jobs' time limit is reached.
489+
The above will send a "SIGKILL" signal 120 seconds before the
490+
Jobs' time limit is reached.
486491
487-
Or, specifying it as a string (sbatch-style):
492+
Or, specifying it as a string (sbatch-style):
488493
489494
signal = "SIGKILL@120"
490495
standard_in (str):
@@ -509,17 +514,21 @@ cdef class JobSubmitDescription:
509514
Generic resource task binding options.
510515
This is the --gres-flags option from sbatch.
511516
517+
512518
Possible values are:
513-
* "enforce-binding"
514-
* "disable-binding"
519+
520+
* `enforce-binding`
521+
* `disable-binding`
515522
temporary_disk_per_node (Union[str, int]):
516523
Amount of temporary disk space needed per node.
517524
518525
This is the same as --tmp from sbatch. You can specify units like
519526
K|M|G|T (multiples of 1024).
520527
If no unit is specified, the value will be assumed as Mebibytes.
521528
529+
522530
Examples:
531+
523532
# 2048 MiB
524533
tmp_disk_per_node = "2G"
525534

0 commit comments

Comments
 (0)