PrEp Plugin API

Overview

This document describes the Slurm PrEp — short for "Pr"olog and "Ep"ilog — plugins API. It is intended as a resource to programmers wishing to write their own Slurm prep plugins.
このドキュメントでは、Slurm PrEp —「Pr」ologおよび「Ep」ilogの略—プラグインAPIについて説明します。独自のSlurm prepプラグインを作成したいプログラマー向けのリソースとして意図されています。

The purpose of the prep plugin APIs to provide a native C interface to the same hooks traditionally used by the Prolog, Epilog, PrologSlurmctld, and EpilogSlurmctld scripts. Those interfaces are now implemented through the prep/script plugin, and that plugin serves as a good example of how to approach development of additional plugins.
prepプラグインAPIの目的は、Prolog、Epilog、PrologSlurmctld、およびEpilogSlurmctldスクリプトで従来から使用されているものと同じフックにネイティブCインターフェイスを提供することです。これらのインターフェースはprep / scriptプラグインを介して実装され、そのプラグインは追加のプラグインの開発に取り組む方法の良い例として機能します。

Slurm PrEp plugins must conform to the Slurm Plugin API with the following specifications:
Slurm PrEpプラグインは、次の仕様のSlurm Plugin APIに準拠している必要があります。

const char plugin_name[]="full text name"

A free-formatted ASCII text string that identifies the plugin.
プラグインを識別する自由形式のASCIIテキスト文字列。

const char plugin_type[]="major/minor"

The major type must be "prep". The minor type can be any suitable name for the type of prep plugin.
主なタイプは「準備」でなければなりません。マイナータイプは、prepプラグインのタイプに適した名前にすることができます。

const uint32_t plugin_version

If specified, identifies the version of Slurm used to build this plugin and any attempt to load the plugin from a different version of Slurm will result in an error.
指定した場合、このプラグインのビルドに使用されたSlurmのバージョンを識別し、異なるバージョンのSlurmからプラグインをロードしようとすると、エラーが発生します。
If not specified, then the plugin may be loaded by Slurm commands and daemons from any version, however this may result in difficult to diagnose failures due to changes in the arguments to plugin functions or changes in other Slurm functions used by the plugin.
指定されていない場合、プラグインはSlurmコマンドとデーモンによって任意のバージョンから読み込まれる可能性がありますが、プラグイン関数の引数の変更やプラグインによって使用される他のSlurm関数の変更が原因で障害を診断することが困難になる場合があります。

Slurm can be configured to use multiple prep plugins if desired through the PrEpPlugins configuration option. Additional plugins should be comma-separated. Note that, by default, the prep/script plugin is loaded if that option is not set, but will not be loaded if an explict setting has been made. Thus, if you do set that option, and intend to still use the Prolog, Epilog, PrologSlurmctld, and/or EpilogSlurmctld options you will need to ensure both your additional plugin and prep/script are set.
PrEpPlugins構成オプションを使用して、必要に応じてSlurmを構成して複数の準備プラグインを使用できます。追加のプラグインはカンマで区切る必要があります。デフォルトでは、prep / scriptプラグインは、そのオプションが設定されていない場合はロードされますが、明示的に設定されている場合はロードされません。したがって、そのオプションを設定し、Prolog、Epilog、PrologSlurmctld、EpilogSlurmctld、あるいはその両方のオプションを引き続き使用する場合は、追加のプラグインと準備/スクリプトの両方が設定されていることを確認する必要があります。

Special care must be used when developing against the prep_p_prolog_slurmctld() or prep_p_epilog_slurmctld() interfaces. These functions are called while the slurmctld holds a number of internal locks, and need to return quickly otherwise slurmctld responsiveness and system throughput will be impacted. For simple logging, this is not required, and the "async" option can be left to false. But, especially for anything communicating with an external API or spawning additional processes, it is highly recommended to first make a local copy of any job record details required, and then spawn a separate processing thread — which, by default, will not have inherited any slurmctld locks — to continue processing.
prep_p_prolog_slurmctld()またはprep_p_epilog_slurmctld()インターフェースに対して開発する場合は、特別な注意が必要です。これらの関数は、slurmctldが多数の内部ロックを保持している間に呼び出され、迅速に戻る必要があります。そうしないと、slurmctldの応答性とシステムのスループットに影響が出ます。単純なロギングの場合、これは必須ではなく、「async」オプションはfalseのままにすることができます。ただし、特に外部APIと通信したり、追加のプロセスを生成したりする場合は、まず必要なジョブレコードの詳細のローカルコピーを作成してから、別の処理スレッドを生成することを強くお勧めします。デフォルトでは、これは継承されません。 slurmctldロック—処理を続行します。
You must set the async return value to true, and call the corresponding prolog_slurmctld_callback() or epilog_slurmctld_callback() function before the thread exits. These callbacks are provided as function pointers when the slurmctld starts through prep_p_register_callbacks() call, and these function pointers should be cached locally in your plugin.
非同期の戻り値をtrueに設定し、スレッドが終了する前に、対応するprolog_slurmctld_callback()またはepilog_slurmctld_callback()関数を呼び出す必要があります。これらのコールバックは、slurmctldがprep_p_register_callbacks()呼び出しを介して開始されるときに関数ポインターとして提供され、これらの関数ポインターはプラグインでローカルにキャッシュされる必要があります。

API Functions

All of the following functions are required. Functions which are not implemented must be stubbed.
以下の機能がすべて必要です。実装されていない関数はスタブする必要があります。

int init(void)

Description:
Called when the plugin is loaded, before any other functions are called. Put global initialization here.
プラグインがロードされたとき、他の関数が呼び出される前に呼び出されます。ここにグローバル初期化を配置します。

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

void fini(void)

Description:
Called when the plugin is removed. Clear any allocated storage here.
プラグインが削除されたときに呼び出されます。ここで割り当て済みのストレージをすべてクリアします。

Returns: None.

Note: These init and fini functions are not the same as those described in the dlopen (3) system library. The C run-time system co-opts those symbols for its own initialization. The system _init() is called before the Slurm init(), and the Slurm fini() is called before the system's _fini().
注:これらのinitおよびfini関数は、dlopen(3)システムライブラリで説明されているものと同じではありません。Cランタイムシステムは、これらのシンボルを独自の初期化用にco-optします。システムの_init()はSlurm init()の前に呼び出され、Slurm fini()はシステムの_fini()の前に呼び出されます。

void prep_p_register_callbacks(prep_callbacks_t *callbacks)

Description:
This function is called by the slurmctld to pass function pointer addresses used with asynchronous operation with the prep_p_prolog_slurmctld() and prep_p_epilog_slurmctld() interfaces. These pointers must be saved if asynchronous operation is used, otherwise this function can be an empty stub.
この関数はslurmctldによって呼び出され、prep_p_prolog_slurmctld()およびprep_p_epilog_slurmctld()インターフェースでの非同期操作で使用される関数ポインターアドレスを渡します。非同期操作を使用する場合、これらのポインターを保存する必要があります。保存しない場合、この関数は空のスタブになる可能性があります。

Arguments:
callbacks (input) contains function pointers for use with asynchronous operation within the slurmctld
コールバック(入力)には、slurmctld内の非同期操作で使用する関数ポインターが含まれています

Returns: None.

int prep_p_prolog(job_env_t *job_env, slurm_cred_t *cred)

Description:
Called within the slurmd as root before the first step of a job starts on the compute node.
ジョブの最初のステップが計算ノードで開始する前に、ルートとしてslurmd内で呼び出されます。

Arguments:
job_env (input) details from the step launch request
ステップ起動リクエストからのjob_env(入力)詳細

cred (input) launch credential with additional verifiable launch details signed by the slurmctld
cred(入力)起動クレデンシャル。slurmctldによって署名された検証可能な追加の起動詳細が含まれます。

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure, will cause job failure.
失敗するとSLURM_ERROR。ジョブが失敗します。

int prep_p_epilog(job_env_t *job_env, slurm_cred_t *cred)

Description:
Called within the slurmd as root after all job steps have completed.
すべてのジョブステップが完了した後、ルートとしてslurmd内で呼び出されます。

Arguments:
job_env (input) details from the step launch request
ステップ起動リクエストからのjob_env(入力)詳細

cred (input) launch credential with additional verifiable launch details signed by the slurmctld
cred(入力)起動クレデンシャル。slurmctldによって署名された検証可能な追加の起動詳細が含まれます。

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure, will cause job failure.

int prep_p_prolog_slurmctld(job_record_t *job_ptr, bool *async)

Description:
Called within the slurmctld before a job launches.
ジョブが起動する前にslurmctld内で呼び出されます。

Arguments:
job_ptr (input) raw job record
job_ptr(入力)生のジョブレコード

async (output) set to true if this interface has spawned a separate processing thread that must complete before the job starts execution
ジョブが実行を開始する前に完了する必要がある別の処理スレッドをこのインターフェースが生成した場合、async(出力)はtrueに設定されます。

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure, will cause job failure.

int prep_p_epilog_slurmctld(job_record_t *job_ptr, bool *async)

Description:
Called within the slurmctld before a job launches.
ジョブが起動する前にslurmctld内で呼び出されます。

Arguments:
job_ptr (input) raw job record
job_ptr(入力)生のジョブレコード

async (output) set to true if this interface has spawned a separate processing thread that must complete before the job is marked complete
ジョブが完了とマークされる前に完了する必要がある別の処理スレッドをこのインターフェースが生成した場合、async(出力)はtrueに設定されます。

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure, will cause job failure.
失敗するとSLURM_ERROR。ジョブが失敗します。

Last modified 22 April 2020