File: prolog_epilog.shtml

package info (click to toggle)
slurm-wlm-contrib 24.11.5-4
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid
  • size: 50,600 kB
  • sloc: ansic: 529,598; exp: 64,795; python: 17,051; sh: 9,411; javascript: 6,528; makefile: 4,030; perl: 3,762; pascal: 131
file content (754 lines) | stat: -rw-r--r-- 27,324 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
<!--#include virtual="header.txt"-->

<h1>Prolog and Epilog Guide</h1>

<p>Slurm supports a multitude of prolog and epilog programs.
Note that for security reasons, these programs do not have a search path set.
Either specify fully qualified path names in the program or set the
<span class="commandline">PATH</span>
environment variable.
The first table below identifies what prologs and epilogs are available for job
allocations, when and where they run.</p>

<center>
	<table style="page-break-inside: avoid; font-family: Arial,Helvetica,sans-serif;" border="1" bordercolor="#000000" cellpadding="6" cellspacing="0" width="100%">
		<colgroup><col width="15%">
		<col width="15%">
		<col width="15%">
		<col width="15%">
		<col width="40%">
		</colgroup><tbody><tr>
			<td bgcolor="#e0e0e0" height="18" width="15%">
				<p align="CENTER"><font style="font-size: 8pt" size="1"><b>Parameter
				</b></font></p>
			</td>
			<td bgcolor="#e0e0e0" height="18" width="15%">
				<p align="CENTER"><font style="font-size: 8pt" size="1"><b>Location
				</b></font></p>
			</td>
			<td bgcolor="#e0e0e0" width="15%">
				<p align="CENTER"><font style="font-size: 8pt" size="1"><b>Invoked by
				</b></font></p>
			</td>
			<td bgcolor="#e0e0e0" width="15%">
				<p align="CENTER"><font style="font-size: 8pt" size="1"><b>User
				</b></font></p>
			</td>
			<td bgcolor="#e0e0e0" width="40%">
				<p align="CENTER"><font style="font-size: 8pt" size="1"><b>When executed
				</b></font></p>
			</td>
		</tr>
		<tr>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Prolog (from slurm.conf)</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Compute or front end node</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				slurmd daemon</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				SlurmdUser (normally user root)</font></p>
			</td>
			<td width="40%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				First job or job step initiation on that node (by default);
				PrologFlags=Alloc will force the script to be executed at
				job allocation</font></p>
			</td>
		</tr>
		<tr>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				PrologSlurmctld (from slurm.conf)</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Head node (where slurmctld daemon runs)</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				slurmctld daemon</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				SlurmctldUser</font></p>
			</td>
			<td width="40%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				At job allocation</font></p>
			</td>
		</tr>
		<tr>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Epilog (from slurm.conf)</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Compute or front end node</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				slurmd daemon</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				SlurmdUser (normally user root)</font></p>
			</td>
			<td width="40%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				At job termination</font></p>
			</td>
		</tr>
		<tr>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				EpilogSlurmctld (from slurm.conf)</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Head node (where slurmctld daemon runs)</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				slurmctld daemon</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				SlurmctldUser</font></p>
			</td>
			<td width="40%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				At job termination</font></p>
			</td>
		</tr>
	</tbody></table>
</center>
<br>
<p>This second table below identifies what prologs and epilogs are available for job
step allocations, when and where they run.</p>

<center>
	<table style="page-break-inside: avoid; font-family: Arial,Helvetica,sans-serif;" border="1" bordercolor="#000000" cellpadding="6" cellspacing="0" width="100%">
		<colgroup><col width="15%">
		<col width="15%">
		<col width="15%">
		<col width="15%">
		<col width="40%">
		</colgroup><tbody><tr>
			<td bgcolor="#e0e0e0" height="18" width="15%">
				<p align="CENTER"><font style="font-size: 8pt" size="1"><b>Parameter
				</b></font></p>
			</td>
			<td bgcolor="#e0e0e0" height="18" width="15%">
				<p align="CENTER"><font style="font-size: 8pt" size="1"><b>Location
				</b></font></p>
			</td>
			<td bgcolor="#e0e0e0" width="15%">
				<p align="CENTER"><font style="font-size: 8pt" size="1"><b>Invoked by
				</b></font></p>
			</td>
			<td bgcolor="#e0e0e0" width="15%">
				<p align="CENTER"><font style="font-size: 8pt" size="1"><b>User
				</b></font></p>
			</td>
			<td bgcolor="#e0e0e0" width="40%">
				<p align="CENTER"><font style="font-size: 8pt" size="1"><b>When executed
				</b></font></p>
			</td>
		</tr>
		<tr>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				SrunProlog (from slurm.conf) or srun --prolog</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				srun invocation node</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				srun command</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				User invoking srun command</font></p>
			</td>
			<td width="40%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Prior to launching job step</font></p>
			</td>
		</tr>
		<tr>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				TaskProlog (from slurm.conf)</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Compute node</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				slurmstepd daemon</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				User invoking srun command</font></p>
			</td>
			<td width="40%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Prior to launching job step</font></p>
			</td>
		</tr>
		<tr>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				srun --task-prolog</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Compute node</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				slurmstepd daemon</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				User invoking srun command</font></p>
			</td>
			<td width="40%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Prior to launching job step</font></p>
			</td>
		</tr>
		<tr>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				TaskEpilog (from slurm.conf)</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Compute node</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				slurmstepd daemon</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				User invoking srun command</font></p>
			</td>
			<td width="40%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Completion job step</font></p>
			</td>
		</tr>
		<tr>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				srun --task-epilog</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Compute node</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				slurmstepd daemon</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				User invoking srun command</font></p>
			</td>
			<td width="40%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Completion job step</font></p>
			</td>
		</tr>
		<tr>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				SrunEpilog (from slurm.conf) or srun --epilog</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				srun invocation node</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				srun command</font></p>
			</td>
			<td height="18" width="15%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				User invoking srun command</font></p>
			</td>
			<td width="40%">
				<p align="LEFT"><font style="font-size: 8pt" size="1">
				Completion job step</font></p>
			</td>
		</tr>
	</tbody></table>
</center>

<p>By default the Prolog script is only run on any individual
node when it first sees a job step from a new allocation; it does not
run the Prolog immediately when an allocation is granted.  If no job steps
from an allocation are run on a node, it will never run the Prolog for that
allocation.  This Prolog behavior can be changed by the
PrologFlags parameter.  The Epilog, on the other hand, always
runs on every node of an allocation when the allocation is released.</p>

<p>If multiple prolog and/or epilog scripts are specified,
(e.g. "/etc/slurm/prolog.d/*") they will run in reverse alphabetical order
(z-a -> Z-A -> 9-0).</p>

<p>Prolog and Epilog scripts should be designed to be as short as possible
and should not call Slurm commands (e.g. squeue, scontrol, sacctmgr, etc).
Long running scripts can cause scheduling problems when jobs take a long time
to start or finish. Slurm commands in these scripts can potentially lead to
performance issues and should not be used.</p>

<p>The task prolog is executed with the same environment as the user tasks to
be initiated. The standard output of that program is read and processed as
follows:<br>
<span class="commandline">export name=value</span>
sets an environment variable for the user task<br>
<span class="commandline">unset name</span>
clears an environment variable from the user task<br>
<span class="commandline">print ...</span>
writes to the task's standard output.<br></p>

<p>A TaskProlog script can just be a bash script. Here is a very basic example:
<pre>
#!/bin/bash

# The TaskProlog script can be used for any preliminary work needed
# before running a job step, and it can also be used to modify the
# user's environment. There are two main mechanisms for that, which
# rely on printing commands to stdout:

# Make a variable available for the user
echo "export VARIABLE_1=HelloWorld"

# Unset variables for the user
echo "unset MANPATH"

# We can also print messages if needed
echo "print This message has been printed with TaskProlog"
</pre></p>

<p>The above functionality is limited to the task prolog script.</p>

<p>Unless otherwise specified, these environment variables are available
to all of the programs.</p>
<ul>
<li><b>CUDA_MPS_ACTIVE_THREAD_PERCENTAGE</b>
Specifies the percentage of a GPU that should be allocated to the job.
The value is set only if the gres/mps plugin is configured and the job
requests those resources.
Available in Prolog and Epilog only.</li>

<li><b>CUDA_VISIBLE_DEVICES</b>
Specifies the GPU devices for the job allocation.
The value is set only if the gres/gpu or gres/mps plugin is configured and the
job requests those resources.
Note that the environment variable set for the job may differ from that set for
the Prolog and Epilog if Slurm is configured to constrain the device files
visible to a job using Linux cgroup.
This is because the Prolog and Epilog programs run <u>outside</u> of any Linux
cgroup while the job runs <u>inside</u> of the cgroup and may thus have a
different set of visible devices.
For example, if a job is allocated the device "/dev/nvidia1", then
<span class="commandline">CUDA_VISIBLE_DEVICES</span> will be set to a value of
"1" in the Prolog and Epilog while the job's value of
<span class="commandline">CUDA_VISIBLE_DEVICES</span> will be set to a
value of "0" (i.e. the first GPU device visible to the job).
<span class="commandline">CUDA_VISIBLE_DEVICES</span> will be set unless
otherwise excluded via the <i>Flags</i> or <i>AutoDetect</i> options in
<i>gres.conf</i>. See also <span class="commandline">SLURM_JOB_GPUS</span>.
Available in Prolog and Epilog only.</li>

<li><b>GPU_DEVICE_ORDINAL</b>
Specifies the GPU devices for the job allocation. The considerations for
<span class="commandline">CUDA_VISIBLE_DEVICES</span> also apply to
<span class="commandline">GPU_DEVICE_ORDINAL</span>.
</li>

<li><b>ROCR_VISIBLE_DEVICES</b>
Specifies the GPU devices for the job allocation. The considerations for
<span class="commandline">CUDA_VISIBLE_DEVICES</span> also apply to
<span class="commandline">ROCR_VISIBLE_DEVICES</span>.
</li>

<li><b>SLURM_ARRAY_JOB_ID</b>
If this job is part of a job array, this will be set to the job ID.
Otherwise it will not be set.
To reference this specific task of a job array, combine
<span class="commandline">SLURM_ARRAY_JOB_ID</span> with
<span class="commandline">SLURM_ARRAY_TASK_ID</span>
(e.g. <span class="commandline">scontrol update
${SLURM_ARRAY_JOB_ID}_{$SLURM_ARRAY_TASK_ID} ...</span>);
Available in PrologSlurmctld, SrunProlog, TaskProlog, EpilogSlurmctld,
SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_ARRAY_TASK_COUNT</b>
If this job is part of a job array, this will be set to the number of
tasks in the array. Otherwise it will not be set.
Available in PrologSlurmctld, SrunProlog, TaskProlog, EpilogSlurmctld,
SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_ARRAY_TASK_ID</b>
If this job is part of a job array, this will be set to the task ID.
Otherwise it will not be set.
To reference this specific task of a job array, combine
<span class="commandline">SLURM_ARRAY_JOB_ID</span> with
<span class="commandline">SLURM_ARRAY_TASK_ID</span>
(e.g. <span class="commandline">scontrol update
${SLURM_ARRAY_JOB_ID}_{$SLURM_ARRAY_TASK_ID} ...</span>);
Available in PrologSlurmctld, SrunProlog, TaskProlog, EpilogSlurmctld,
SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_ARRAY_TASK_MAX</b>
If this job is part of a job array, this will be set to the maximum
task ID.
Otherwise it will not be set.
Available in PrologSlurmctld, SrunProlog, TaskProlog, EpilogSlurmctld,
SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_ARRAY_TASK_MIN</b>
If this job is part of a job array, this will be set to the minimum
task ID.
Otherwise it will not be set.
Available in PrologSlurmctld, SrunProlog, TaskProlog, EpilogSlurmctld,
SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_ARRAY_TASK_STEP</b>
If this job is part of a job array, this will be set to the step
size of task IDs.
Otherwise it will not be set.
Available in PrologSlurmctld, SrunProlog, TaskProlog, EpilogSlurmctld,
SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_CLUSTER_NAME</b>
Name of the cluster executing the job. Available in Prolog, PrologSlurmctld,
Epilog and EpilogSlurmctld.</li>

<li><b>SLURM_CONF</b>
Location of the slurm.conf file. Available in Prolog, SrunProlog, TaskProlog,
Epilog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_CPUS_ON_NODE</b>
Count of processors available to the job on current node. Available in
SrunProlog, TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_DISTRIBUTION</b>
Distribution type for the job. Available in SrunProlog, TaskProlog, SrunEpilog
and TaskEpilog.</li>

<li><b>SLURMD_NODENAME</b>
Name of the node running the task. In the case of a parallel job executing
on multiple compute nodes, the various tasks will have this environment
variable set to different values on each compute node. Available in Prolog,
SrunProlog, TaskProlog, Epilog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_GPUS</b>
Count of the GPUs available to the job. Available in SrunProlog, TaskProlog,
SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_GTID</b>
Global Task IDs running on this node. Zero origin and comma separated.
Available in SrunProlog, TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_JOB_ACCOUNT</b>
Account name used for the job.</li>

<li><b>SLURM_JOB_COMMENT</b>
Comment added to the job.
Available in Prolog, PrologSlurmctld, Epilog and EpilogSlurmctld.</li>

<li><b>SLURM_JOB_CONSTRAINTS</b>
Features required to run the job.
Available in Prolog, PrologSlurmctld, Epilog and EpilogSlurmctld.</li>

<li><b>SLURM_JOB_CPUS_PER_NODE</b>
Count of processors available per node.</li>

<li><b>SLURM_JOB_DERIVED_EC</b>
The highest exit code of all of the job steps.
Available in Epilog and EpilogSlurmctld.</li>

<li><b>SLURM_JOB_END_TIME</b>
The UNIX timestamp for a job's end time.</li>

<li><b>SLURM_JOB_EXIT_CODE</b>
The exit code of the job script (or salloc). The value is the status
as returned by the <span class="commandline">wait()</span> system call
(See <span class="commandline">wait(2)</span>).
Available in Epilog and EpilogSlurmctld.</li>

<li><b>SLURM_JOB_EXIT_CODE2</b>
The exit code of the job script (or salloc). The value has the format
<span class="commandline">&lt;exit&gt;:&lt;sig&gt;</span>.
The first number is the exit code, typically as set by the
<span class="commandline">exit()</span> function.
The second number is the signal that caused the process to
terminate if it was terminated by a signal.
Available in Epilog and EpilogSlurmctld.</li>

<li><b>SLURM_JOB_EXTRA</b>
Extra field added to the job.
Available in Prolog, PrologSlurmctld, Epilog, EpilogSlurmctld, and
ResumeProgram (via SLURM_RESUME_FILE).</li>

<li><b>SLURM_JOB_GID</b>
Group ID of the job's owner.</li>

<li><b>SLURM_JOB_GPUS</b>
The GPU IDs of GPUs in the job allocation (if any).
Available in the Prolog, SrunProlog, TaskProlog, Epilog, SrunEpilog and
TaskProlog.</li>

<li><b>SLURM_JOB_GROUP</b>
Group name of the job's owner.
Available in PrologSlurmctld and EpilogSlurmctld.</li>

<li><b>SLURM_JOB_ID</b>
Job ID.</li>

<li><b>SLURM_JOBID</b>
Job ID.</li>

<li><b>SLURM_JOB_LICENSES</b>
Name and count of any license(s) requested.</li>

<li><b>SLURM_JOB_NAME</b>
Name of the job.
Available in PrologSlurmctld, SrunProlog, TaskProlog, EpilogSlurmctld,
SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_JOB_NODELIST</b>
Nodes assigned to job. A Slurm hostlist expression.
<span class="commandline">scontrol show hostnames</span>
can be used to convert this to a
list of individual host names.</li>

<li><b>SLURM_NTASKS</b>
Number of tasks requested by the job.
Available in SrunProlog, TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_JOB_NUM_NODES</b>
Number of nodes assigned to a job.</li>

<li><b>SLURM_JOB_OVERSUBSCRIBE</b>
Job OverSubscribe status.
See the <a href="squeue.html#OPT_OverSubscribe">squeue man page</a> for
possible values.
Available in Prolog, PrologSlurmctld, Epilog and EpilogSlurmctld.</li>

<li><b>SLURM_JOB_PARTITION</b>
Partition that job runs in.</li>

<li><b>SLURM_JOB_QOS</b>
QOS assigned to job. Available in SrunProlog, TaskProlog, SrunEpilog
and TaskEpilog.</li>

<li><b>SLURM_JOB_RESERVATION</b>
Reservation requested for the job.</li>

<li><b>SLURM_JOB_RESTART_COUNT</b>
Number of times the job has been restarted.
Available in Prolog, PrologSlurmctld, Epilog and EpilogSlurmctld.</li>

<li><b>SLURM_JOB_START_TIME</b>
The UNIX timestamp of a job's start time.</li>

<li><b>SLURM_JOB_STDERR</b>
Job's stderr path.
Available in Prolog, PrologSlurmctld, Epilog and EpilogSlurmctld.</li>

<li><b>SLURM_JOB_STDIN</b>
Job's stdin path.
Available in Prolog, PrologSlurmctld, Epilog and EpilogSlurmctld.</li>

<li><b>SLURM_JOB_STDOUT</b>
Job's stdout path.
Available in Prolog, PrologSlurmctld, Epilog and EpilogSlurmctld.</li>

<li><b>SLURM_JOB_UID</b>
User ID of the job's owner.</li>

<li><b>SLURM_JOB_USER</b>
User name of the job's owner.</li>

<li><b>SLURM_JOB_WORK_DIR</b>
Job's working directory. Available in Prolog, PrologSlurmctld, Epilog,
EpilogSlurmctld.</li>

<li><b>SLURM_LOCAL_GLOBALS_FILE</b>
Globals file used to set up the environment for the testsuite. Available
in SrunProlog, TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_LOCALID</b>
Node local task ID for the process within a job. Available in SrunProlog,
TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_NNODES</b>
Number of nodes assigned to a job. Available in SrunProlog, TaskProlog,
SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_NODEID</b>
ID of current node relative to other nodes in a multi-node job. Available in
SrunProlog, TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_PRIO_PROCESS</b>
Scheduling priority (nice value) at the time of submission. Available in
SrunProlog, TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_PROCID</b>
The MPI rank (or relative process ID) of the current process. Available in
SrunProlog, TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_RESTART_COUNT</b>
Number of times the job has been restarted. This is only set if the job
has been restarted at least once. Available in SrunProlog, TaskProlog,
SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_RLIMIT_AS</b>
Resource limit on the job's address space. Available in SrunProlog,
TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_RLIMIT_CORE</b>
Resource limit on the size of a core file the job is able to produce.
Available in SrunProlog, TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_RLIMIT_CPU</b>
Resource limit on the amount of CPU time a job is able to use. Available
in SrunProlog, TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_RLIMIT_DATA</b>
Resource limit on the size of a job's data segment. Available in SrunProlog,
TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_RLIMIT_FSIZE</b>
Resource limit on the maximum size of files a job may create. Available in
SrunProlog, TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_RLIMIT_MEMLOCK</b>
Resource limit on the bytes of data that may be locked into RAM. Available
in SrunProlog, TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_RLIMIT_NOFILE</b>
Resource limit on the number of file descriptors that can be opened by the
job. Available in SrunProlog, TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_RLIMIT_NPROC</b>
Resource limit on the number of processes that can be opened by the calling
process. Available in SrunProlog, TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_RLIMIT_RSS</b>
Resource limit on the job's resident set size. Available in SrunProlog,
TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_RLIMIT_STACK</b>
Resource limit on the job's process stack. Available in SrunProlog,
TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_SCRIPT_CONTEXT</b>
Identifies which epilog or prolog program is currently running.
The value is one of the following:
<ul>
<li><span class="commandline">prolog_slurmctld</span></li>
<li><span class="commandline">epilog_slurmctld</span></li>
<li><span class="commandline">prolog_slurmd</span></li>
<li><span class="commandline">epilog_slurmd</span></li>
<li><span class="commandline">prolog_task</span></li>
<li><span class="commandline">epilog_task</span></li>
<li><span class="commandline">prolog_srun</span></li>
<li><span class="commandline">epilog_srun</span></li>
</ul>
</li>

<li><b>SLURM_STEP_ID</b>
Step ID of the current job. Available in SrunProlog, TaskProlog, SrunEpilog
and TaskEpilog.</li>

<li><b>SLURM_STEPID</b>
Step ID of the current job. Available in SrunProlog and SrunEpilog.</li>

<li><b>SLURM_SUBMIT_DIR</b>
Directory from which the job was submitted or, if applicable, the directory
specified by the <b>-D, --chdir</b> option. Available in SrunProlog,
Taskprolog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_SUBMIT_HOST</b>
Host from which the job was submitted. Available in SrunProlog, TaskProlog,
SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_TASK_PID</b>
Process ID of the process started for the task. Available in SrunProlog,
TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_TASKS_PER_NODE</b>
Number of tasks per node. Available in SrunProlog, TaskProlog, SrunEpilog
and TaskEpilog.</li>

<li><b>SLURM_TOPOLOGY_ADDR</b>
Set to the names of network switches or nodes that may be involved in the
job's communications. Starts with the top level switch down to the node name.
A period is used to separate each hardware component name. Available in
SrunProlog, TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_TOPOLOGY_ADDR_PATTERN</b>
Set to the network component types that corresponds with the list of names
from <b>SLURM_TOPOLOGY_ADDR</b>. Each component will be identified as either
<u>switch</u> or <u>node</u>. A period is used to separate each component
type. Available in SrunProlog, TaskProlog, SrunEpilog and TaskEpilog.</li>

<li><b>SLURM_WCKEY</b>
User name of the job's wckey (if any).
Available in PrologSlurmctld and EpilogSlurmctld only.</li>

<p>Plugin functions may also be useful to execute logic at various well-defined
points.</p>

<p><a href="spank.html">SPANK</a> is another mechanism that may be useful
to invoke logic in the user commands, slurmd daemon, and slurmstepd daemon.</p>

<h2 id="failure_handling">Failure Handling
<a class="slurm_link" href="#failure_handling"></a>
</h2>
<p>If the Epilog fails (returns a non-zero exit code), this will result in the
node being set to a DRAIN state.
If the EpilogSlurmctld fails (returns a non-zero exit code), this will only
be logged.
If the Prolog fails (returns a non-zero exit code), this will result in the
node being set to a DRAIN state and the job requeued. The job will be placed
in a held state unless nohold_on_prolog_fail is configured in
SchedulerParameters.
If the PrologSlurmctld fails (returns a non-zero exit code), this will cause
the job to be requeued. Only batch jobs can be requeued. Interactive jobs
(salloc and srun) will be cancelled if the PrologSlurmctld fails.</p>

<p>If a task epilog or srun epilog fails (returns a non-zero exit code) this
will only be logged.
If a task prolog fails (returns a non-zero exit code), the task will be
canceled.
If the srun prolog fails (returns a non-zero exit code), the step will be
canceled.</p>

<HR SIZE=4>

<p>Based upon work by Jason Sollom, Cray Inc. and used by permission.</p>

<p style="text-align:center;">Last modified 23 September 2024</p>

<!--#include virtual="footer.txt"-->