PrEp Plugin API

Overview

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

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.
prepプラグインAPIの目的は、Prolog、Epilog、PrologSlurmctld、およびEpilogSlurmctldスクリプトで従来使用されていたものと同じフックにネイティブCインターフェイスを提供することです。
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 / scriptプラグインを介して実装されており、そのプラグインは、追加のプラグインの開発に取り組む方法の良い例として役立ちます。

Slurm PrEp plugins must conform to the Slurm Plugin API with the following specifications:
Slurm PrEpプラグインは、次の仕様のSlurmプラグイン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.
必要に応じて、PrEpPlugins構成オプションを使用して、複数のprepプラグインを使用するようにSlurmを構成できます。
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.
デフォルトでは、そのオプションが設定されていない場合はprep / scriptプラグインがロードされますが、明示的な設定が行われている場合はロードされないことに注意してください。
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.
したがって、そのオプションを設定し、Prolog、Epilog、PrologSlurmctld、および/またはEpilogSlurmctldオプションを引き続き使用する場合は、追加のプラグインとprep / scriptの両方が設定されていることを確認する必要があります。

Special care must be used when developing against the prep_p_prolog_slurmctld() or prep_p_epilog_slurmctld() interfaces.
prep_p_prolog_slurmctld()またはprep_p_epilog_slurmctld()インターフェースに対して開発する場合は、特別な注意を払う必要があります。
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.
これらの関数は、slurmctldが多数の内部ロックを保持しているときに呼び出され、すぐに戻る必要があります。そうしないと、slurmctldの応答性とシステムスループットが影響を受けます。
For simple logging, this is not required, and the "async" option can be left to false.
単純なロギングの場合、これは必須ではなく、「async」オプションは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.
ただし、特に外部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.
非同期戻り値をtrueに設定し、スレッドが終了する前に、対応するprolog_slurmctld_callback()またはepilog_slurmctld_callback()関数を呼び出す必要があります。
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.
これらのコールバックは、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.
注:これらのinitおよびfini関数は、dlopen(3)システムライブラリで説明されているものと同じではありません。
The C run-time system co-opts those symbols for its own initialization.
Cランタイムシステムは、独自の初期化のためにこれらのシンボルを採用します。
The system _init() is called before the Slurm init(), and the Slurm fini() is called before the system's _fini().
システム_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.
この関数はslurmctldによって呼び出され、prep_p_prolog_slurmctld()およびprep_p_epilog_slurmctld()インターフェースを使用した非同期操作で使用される関数ポインターアドレスを渡します。
These pointers must be saved if asynchronous operation is used, otherwise this function can be an empty stub.
非同期操作を使用する場合は、これらのポインターを保存する必要があります。そうしないと、この関数が空のスタブになる可能性があります。

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内でrootとして呼び出されます。

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
slurmctldによって署名された追加の検証可能な起動詳細を含むcred(入力)起動資格情報

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内でrootとして呼び出されます。

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
slurmctldによって署名された追加の検証可能な起動詳細を含むcred(入力)起動資格情報

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