Prolog and Epilog Guide
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
PATH
environment variable.
Slurmは、多数のプロローグプログラムとエピローグプログラムをサポートしています。セキュリティ上の理由から、これらのプログラムには検索パスが設定されていないことに注意してください。プログラムで完全修飾パス名を指定するか、PATH環境変数を設定します。
The first table below identifies what prologs and epilogs are available for job
allocations, when and where they run.
以下の最初の表は、ジョブ割り当てに使用できるプロローグとエピローグを、いつ、どこで実行するかを示しています。
Parameter |
Location |
Invoked by |
User |
When executed |
Prolog (from slurm.conf) |
Compute or front end node |
slurmd daemon |
SlurmdUser (normally user root) |
First job or job step initiation on that node (by default); PrologFlags=Alloc will force the script to be executed at job allocation |
PrologSlurmctld (from slurm.conf) |
Head node (where slurmctld daemon runs) |
slurmctld daemon |
SlurmctldUser |
At job allocation |
Epilog (from slurm.conf) |
Compute or front end node |
slurmd daemon |
SlurmdUser (normally user root) |
At job termination |
EpilogSlurmctld (from slurm.conf) |
Head node (where slurmctld daemon runs) |
slurmctld daemon |
SlurmctldUser |
At job termination |
This second table below identifies what prologs and epilogs are available for job
step allocations, when and where they run.
次の2番目の表は、ジョブステップの割り当てに使用できるプロローグとエピローグを、いつ、どこで実行するかを示しています。
Parameter |
Location |
Invoked by |
User |
When executed |
SrunProlog (from slurm.conf) or srun --prolog |
srun invocation node |
srun command |
User invoking srun command |
Prior to launching job step |
TaskProlog (from slurm.conf) |
Compute node |
slurmstepd daemon |
User invoking srun command |
Prior to launching job step |
srun --task-prolog |
Compute node |
slurmstepd daemon |
User invoking srun command |
Prior to launching job step |
TaskEpilog (from slurm.conf) |
Compute node |
slurmstepd daemon |
User invoking srun command |
Completion job step |
srun --task-epilog |
Compute node |
slurmstepd daemon |
User invoking srun command |
Completion job step |
SrunEpilog (from slurm.conf) or srun --epilog |
srun invocation node |
srun command |
User invoking srun command |
Completion job step |
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 behaviour 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.
デフォルトでは、Prologスクリプトは、新しい割り当てからのジョブステップを最初に検出したときに、個々のノードでのみ実行されます。割り振りが許可されても、Prologはすぐには実行されません。ノードで割り当てのジョブステップが実行されない場合、その割り当てのプロローグは実行されません。このPrologの動作は、PrologFlagsパラメーターによって変更できます。一方、Epilogは、割り当てが解放されると、常に割り当てのすべてのノードで実行されます。
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:
タスクプロローグは、開始されるユーザータスクと同じ環境で実行されます。そのプログラムの標準出力は、次のように読み取られて処理されます。
export name=value
sets an environment variable for the user task
export name = valueは、ユーザータスクの環境変数を設定します
unset name
clears an environment variable from the user task
unset nameは、ユーザータスクから環境変数をクリアします
print ...
writes to the task's standard output.
print ...タスクの標準出力に書き込みます。
The above functionality is limited to the task prolog script.
上記の機能は、タスクプロローグスクリプトに限定されています。
Unless otherwise specified, these environment variables are available
to all of the programs.
特に指定のない限り、これらの環境変数はすべてのプログラムで使用できます。
- CUDA_MPS_ACTIVE_THREAD_PERCENTAGE
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.
ジョブに割り当てるGPUの割合を指定します。この値は、gres / mpsプラグインが構成されており、ジョブがそれらのリソースを要求する場合にのみ設定されます。PrologおよびEpilogでのみ使用できます。 - CUDA_VISIBLE_DEVICES
Specifies the GPU devices that should be allocated to the job.
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 outside of any Linux
cgroup while the job runs inside of the cgroup and may thus have a
different set of visible devices.
ジョブに割り当てる必要があるGPUデバイスを指定します。この値は、gres / gpuまたはgres / mpsプラグインが構成されており、ジョブがそれらのリソースを要求する場合にのみ設定されます。Linuxのcgroupを使用してジョブに表示されるデバイスファイルを制約するようにSlurmが構成されている場合、ジョブに設定された環境変数は、PrologおよびEpilogに設定されたものと異なる場合があります。これは、ジョブがcgroupの内部で実行されている間、PrologおよびEpilogプログラムがLinux cgroupの外部で実行されるため、表示されるデバイスのセットが異なる可能性があるためです。
For example, if a job is allocated the device "/dev/nvidia1", then CUDA_VISIBLE_DEVICES will be set to a value of "1" in the Prolog and Epilog while the job's value of CUDA_VISIBLE_DEVICES will be set to a value of "0" (i.e. the first GPU device visible to the job). Available in Prolog and Epilog only.
たとえば、ジョブにデバイス「/ dev / nvidia1」が割り当てられている場合、ジョブのCUDA_VISIBLE_DEVICESの値は「0」の値に設定されますが、プロローグとエピローグではCUDA_VISIBLE_DEVICESの値が「1」に設定されます。 (つまり、ジョブから見える最初のGPUデバイス)。PrologおよびEpilogでのみ使用できます。 - SLURM_ARRAY_JOB_ID
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
SLURM_ARRAY_JOB_ID with
SLURM_ARRAY_TASK_ID
(e.g. scontrol update
${SLURM_ARRAY_JOB_ID}_{$SLURM_ARRAY_TASK_ID} ...);
Available in PrologSlurmctld and EpilogSlurmctld only.
このジョブがジョブ配列の一部である場合、これはジョブIDに設定されます。それ以外の場合は設定されません。ジョブ配列のこの特定のタスクを参照するには、SLURM_ARRAY_JOB_IDをSLURM_ARRAY_TASK_IDと組み合わせます(例:scontrol update $ {SLURM_ARRAY_JOB_ID} _ {$ SLURM_ARRAY_TASK_ID} ...); PrologSlurmctldおよびEpilogSlurmctldでのみ使用できます。 - SLURM_ARRAY_TASK_ID
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
SLURM_ARRAY_JOB_ID with
SLURM_ARRAY_TASK_ID
(e.g. scontrol update
${SLURM_ARRAY_JOB_ID}_{$SLURM_ARRAY_TASK_ID} ...);
Available in PrologSlurmctld and EpilogSlurmctld only.
このジョブがジョブ配列の一部である場合、これはタスクIDに設定されます。それ以外の場合は設定されません。ジョブ配列のこの特定のタスクを参照するには、SLURM_ARRAY_JOB_IDをSLURM_ARRAY_TASK_IDと組み合わせます(例:scontrol update $ {SLURM_ARRAY_JOB_ID} _ {$ SLURM_ARRAY_TASK_ID} ...); PrologSlurmctldおよびEpilogSlurmctldでのみ使用できます。 - SLURM_ARRAY_TASK_MAX
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 and EpilogSlurmctld only.
このジョブがジョブ配列の一部である場合、これは最大タスクIDに設定されます。それ以外の場合は設定されません。PrologSlurmctldおよびEpilogSlurmctldでのみ使用できます。 - SLURM_ARRAY_TASK_MIN
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 and EpilogSlurmctld only.
このジョブがジョブ配列の一部である場合、これは最小タスクIDに設定されます。それ以外の場合は設定されません。PrologSlurmctldおよびEpilogSlurmctldでのみ使用できます。 - SLURM_ARRAY_TASK_STEP
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 and EpilogSlurmctld only.
このジョブがジョブ配列の一部である場合、これはタスクIDのステップサイズに設定されます。それ以外の場合は設定されません。PrologSlurmctldおよびEpilogSlurmctldでのみ使用できます。 - SLURM_CLUSTER_NAME
Name of the cluster executing the job.
ジョブを実行しているクラスターの名前。 - SLURM_JOB_GPUS
GPU IDs allocated to the job (if any).
Available in the Prolog only.
ジョブに割り当てられたGPU ID(存在する場合)。プロローグでのみ使用できます。 - SLURM_JOB_ACCOUNT
Account name used for the job.
Available in PrologSlurmctld and EpilogSlurmctld only.
ジョブに使用されるアカウント名。PrologSlurmctldおよびEpilogSlurmctldでのみ使用できます。 - SLURM_JOB_CONSTRAINTS
Features required to run the job.
Available in Prolog, PrologSlurmctld and EpilogSlurmctld only.
ジョブの実行に必要な機能。Prolog、PrologSlurmctld、およびEpilogSlurmctldでのみ使用できます。 - SLURM_JOB_DERIVED_EC
The highest exit code of all of the job steps.
Available in EpilogSlurmctld only.
すべてのジョブステップの最高の終了コード。EpilogSlurmctldでのみ使用できます。 - SLURM_JOB_EXIT_CODE
The exit code of the job script (or salloc). The value is the status
as returned by the wait() system call
(See wait(2)).
Available in EpilogSlurmctld only.
ジョブスクリプト(またはsalloc)の終了コード。値は、wait()システムコールによって返されるステータスです(wait(2)を参照)。EpilogSlurmctldでのみ使用できます。 - SLURM_JOB_EXIT_CODE2
The exit code of the job script (or salloc). The value has the format
<exit>:<sig>.
The first number is the exit code, typically as set by the
exit() function.
The second number is the signal that caused the process to
terminate if it was terminated by a signal.
Available in EpilogSlurmctld only.
ジョブスクリプト(またはsalloc)の終了コード。値の形式は:。最初の番号は、通常はexit()関数によって設定された終了コードです。2番目の番号は、プロセスがシグナルによって終了された場合にプロセスを終了させたシグナルです。EpilogSlurmctldでのみ使用できます。 - SLURM_JOB_GID
Group ID of the job's owner.
Available in PrologSlurmctld and EpilogSlurmctld only.
ジョブの所有者のグループID。PrologSlurmctldおよびEpilogSlurmctldでのみ使用できます。 - SLURM_JOB_GROUP
Group name of the job's owner.
Available in PrologSlurmctld and EpilogSlurmctld only.
ジョブの所有者のグループ名。PrologSlurmctldおよびEpilogSlurmctldでのみ使用できます。 - SLURM_JOB_ID
Job ID.
CAUTION: If this job is the first task of a job array, then Slurm commands using
this job ID will refer to the entire job array rather than this specific task
of the job array.
ジョブID。注意:このジョブがジョブ配列の最初のタスクである場合、このジョブIDを使用するSlurmコマンドは、ジョブ配列のこの特定のタスクではなく、ジョブ配列全体を参照します。 - SLURM_JOB_NAME
Name of the job.
Available in PrologSlurmctld and EpilogSlurmctld only.
ジョブの名前。PrologSlurmctldおよびEpilogSlurmctldでのみ使用できます。 - SLURM_JOB_NODELIST
Nodes assigned to job. A Slurm hostlist expression.
scontrol show hostnames
can be used to convert this to a
list of individual host names.
Available in PrologSlurmctld and EpilogSlurmctld only.
ジョブに割り当てられたノード。Slurmホストリスト式。scontrol show hostnamesを使用して、これを個々のホスト名のリストに変換できます。PrologSlurmctldおよびEpilogSlurmctldでのみ使用できます。 - SLURM_JOB_PARTITION
Partition that job runs in.
Available in Prolog, PrologSlurmctld and EpilogSlurmctld
only.
ジョブが実行されるパーティション。Prolog、PrologSlurmctld、およびEpilogSlurmctldでのみ使用できます。 - SLURM_JOB_UID
User ID of the job's owner.
ジョブの所有者のユーザーID。 - SLURM_JOB_USER
User name of the job's owner.
ジョブの所有者のユーザー名。 - SLURM_SCRIPT_CONTEXT
Identifies which epilog or prolog program is currently running.
The value is one of the following:
現在実行されているエピローグまたはプロローグプログラムを識別します。値は次のいずれかです。
- prolog_slurmctld
- epilog_slurmctld
- prolog_slurmd
- epilog_slurmd
- prolog_task
- epilog_task
- prolog_srun
- epilog_srun
- SLURM_WCKEY
User name of the job's wckey (if any).
Available in PrologSlurmctld and EpilogSlurmctld only.
ジョブのwckeyのユーザー名(ある場合)。PrologSlurmctldおよびEpilogSlurmctldでのみ使用できます。
Plugin functions may also be useful to execute logic at various well-defined
points.
プラグイン関数は、明確に定義されたさまざまなポイントでロジックを実行するのにも役立ちます。
SPANK is another mechanism that may be useful
to invoke logic in the user commands, slurmd daemon, and slurmstepd daemon.
SPANKは、ユーザーコマンド、slurmdデーモン、およびslurmstepdデーモンのロジックを呼び出すのに役立つ別のメカニズムです。
Failure Handling
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 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.
Epilogが失敗した場合(ゼロ以外の終了コードを返す)、これによりノードがDRAIN状態に設定されます。EpilogSlurmctldが失敗した場合(ゼロ以外の終了コードを返す)、これはログに記録されるだけです。プロローグが失敗した場合(ゼロ以外の終了コードを返す)、これによりノードがDRAIN状態に設定され、ジョブが保留状態で再度キューに入れられます(nohold_on_prolog_failがSchedulerParametersで構成されている場合を除く)。PrologSlurmctldが失敗した場合(ゼロ以外の終了コードを返す)、これによりジョブが再キューイングされます。再キューイングできるのはバッチジョブのみです。対話型ジョブ(sallocおよびsrun)は、PrologSlurmctldが失敗するとキャンセルされます。
Based upon work by Jason Sollom, Cray Inc. and used by permission.
Jason Sollom、Cray Inc.の著作に基づいており、許可を得て使用しています。
Last modified 24 March 2020