Job Exit Codes

A job's exit code (aka exit status, return code and completion code) is captured by Slurm and saved as part of the job record. For sbatch jobs, the exit code that is captured is the output of the batch script. For salloc jobs, the exit code will be the return value of the exit call that terminates the salloc session. For srun, the exit code will be the return value of the command that srun executes.
ジョブの終了コード(別名、終了ステータス、戻りコード、完了コード)はSlurmによってキャプチャされ、ジョブレコードの一部として保存されます。sbatchジョブの場合、キャプチャされる終了コードはバッチスクリプトの出力です。sallocジョブの場合、終了コードは、sallocセッションを終了する終了呼び出しの戻り値になります。srunの場合、終了コードは、srunが実行するコマンドの戻り値になります。

Any non-zero exit code will be assumed to be a job failure and will result in a Job State of FAILED with a Reason of "NonZeroExitCode".
ゼロ以外の終了コードはジョブの失敗と見なされ、「NonZeroExitCode」の理由でジョブの状態がFAILEDになります。

The exit code is an 8 bit unsigned number ranging between 0 and 255. While it is possible for a job to return a negative exit code, Slurm will display it as an unsigned value in the 0 - 255 range.
終了コードは、0〜255の範囲の8ビット符号なし数値です。ジョブが負の終了コードを返すことは可能ですが、Slurmはそれを0〜255の範囲の符号なし値として表示します。

Job Step Exit Codes

When a job contains multiple job steps, the exit code of each executable invoked by srun is saved individually to the job step record.
ジョブに複数のジョブステップが含まれている場合、srunによって呼び出される各実行可能ファイルの終了コードは、ジョブステップレコードに個別に保存されます。

Signaled Jobs

When a job or step is sent a signal that causes its termination, Slurm also captures the signal number and saves it to the job or step record.
ジョブまたはステップに終了を引き起こすシグナルが送信されると、Slurmはシグナル番号もキャプチャして、ジョブまたはステップレコードに保存します。

Displaying Exit Codes and Signals

Slurm displays a job's exit code in the output of the scontrol show job and the sview utility. Slurm displays job step exit codes in the output of the scontrol show step and the sview utility.
Slurmは、scontrol showジョブとsviewユーティリティの出力にジョブの終了コードを表示します。Slurmは、scontrol showステップとsviewユーティリティの出力にジョブステップの終了コードを表示します。

When a signal was responsible for a job or step's termination, the signal number will be displayed after the exit code, delineated by a colon(:).
シグナルがジョブまたはステップの終了の原因であった場合、シグナル番号は終了コードの後に​​表示され、コロン(:)で区切られます。

Database Job/Step Records

The Slurm control daemon sends job and step records to the Slurm database when the Slurm accounting_storage plugin is installed. Job and step records sent to the Slurm db can be viewed using the sacct command. The default sacct output contains an ExitCode field whose format mirrors the output of scontrol and sview described above.
Slurm accounting_storageプラグインがインストールされている場合、Slurm制御デーモンはジョブおよびステップレコードをSlurmデータベースに送信します。Slurm dbに送信されたジョブとステップのレコードは、sacctコマンドを使用して表示できます。デフォルトのsacct出力には、ExitCodeフィールドが含まれています。このフォーマットは、上記のscontrolおよびsviewの出力を反映しています。

Derived Exit Code and Comment String

After reading the above description of a job's exit code, one can imagine a scenario where a central task of a batch job fails but the script returns an exit code of zero, indicating success. In many cases, a user may not be able to ascertain the success or failure of a job until after they have examined the job's output files.
上記のジョブの終了コードの説明を読んだ後、バッチジョブの中心的なタスクが失敗しても、スクリプトが成功を示すゼロの終了コードを返すシナリオを想像できます。多くの場合、ユーザーは、ジョブの出力ファイルを確認するまで、ジョブの成功または失敗を確認できない場合があります。

The job includes a "derived exit code" field. It is initially set to the value of the highest exit code returned by all of the job's steps (srun invocations). The job's derived exit code is determined by the Slurm control daemon and sent to the database when the accounting_storage plugin is enabled.
ジョブには、「派生終了コード」フィールドが含まれています。最初は、ジョブのすべてのステップ(srun呼び出し)によって返される最高の終了コードの値に設定されます。ジョブの派生終了コードはSlurm制御デーモンによって決定され、accounting_storageプラグインが有効なときにデータベースに送信されます。

In addition to the derived exit code, the job record in the Slurm database contains a comment string. This is initialized to the job's comment string (when AccountingStoreJobComment parameter in the slurm.conf is set) and can only be changed by the user.
派生した終了コードに加えて、Slurmデータベースのジョブレコードにはコメント文字列が含まれています。これはジョブのコメント文字列に初期化され(slurm.confのAccountingStoreJobCommentパラメータが設定されている場合)、ユーザーのみが変更できます。

A new option has been added to the sacctmgr command to provide the user the means to modify these two fields of the job record. No other modification to the job record is allowed. For those who prefer a simpler command specifically designed to view and modify the derived exit code and comment string, the sjobexitmod wrapper has been created (see below).
sacctmgrコマンドに新しいオプションが追加され、ジョブレコードのこれら2つのフィールドを変更する手段をユーザーに提供します。ジョブレコードに対する他の変更は許可されません。派生した終了コードとコメント文字列を表示および変更するために特別に設計されたより単純なコマンドを好む人のために、sjobexitmodラッパーが作成されました(以下を参照)。

The user now has the means to annotate a job's exit code after it completes and provide a description of what failed. This includes the ability to annotate a successful completion to jobs that appear to have failed but actually succeeded.
ユーザーは、ジョブの完了後にジョブの終了コードに注釈を付け、失敗した内容の説明を提供する手段を手に入れました。これには、失敗したように見えても実際には成功したジョブに、正常に完了したことを注釈する機能が含まれます。

The sjobexitmod command

The sjobexitmod command is available to display and update the two derived exit fields of the Slurm db's job record. sjobexitmod can first be used to display the existing exit code / string for a job:
sjobexitmodコマンドを使用して、Slurm dbのジョブレコードの2つの派生出口フィールドを表示および更新できます。最初にsjobexitmodを使用して、ジョブの既存の終了コード/文字列を表示できます。

> sjobexitmod -l 123
JobID Account NNodes NodeList     State ExitCode DerivedExitCode Comment
----- ------- ------ -------- --------- -------- --------------- -------
123        lc      1     tux0 COMPLETED      0:0             0:0
If a change is desired, sjobexitmod can modify the derived fields:
変更が必要な場合、sjobexitmodは派生フィールドを変更できます。
> sjobexitmod -e 49 -r "out of memory" 123

 Modification of job 123 was successful.

> sjobexitmod -l 123
JobID Account NNodes NodeList     State ExitCode DerivedExitCode Comment
----- ------- ------ -------- --------- -------- --------------- -------
123        lc      1     tux0 COMPLETED      0:0            49:0 out of memory

The existing sacct command also supports the two new derived exit fields:
既存のsacctコマンドは、2つの新しい派生出口フィールドもサポートしています。

> sacct -X -j 123 -o JobID,NNodes,State,ExitCode,DerivedExitcode,Comment
JobID   NNodes      State ExitCode DerivedExitCode        Comment
------ ------- ---------- -------- --------------- --------------
123          1  COMPLETED      0:0            49:0  out of memory

Last modified 15 April 2015