Slurm Process Tracking Plugin API

Overview

This document describes Slurm process tracking plugins and the API that defines them. It is intended as a resource to programmers wishing to write their own Slurm process tracking plugins. Note that process tracking plugin is designed for use with Slurm job steps. There is a job_container plugin designed for use with Slurm jobs.
このドキュメントでは、Slurmプロセス追跡プラグインとそれらを定義するAPIについて説明します。独自のSlurmプロセストラッキングプラグインを作成したいプログラマへのリソースとして意図されています。プロセス追跡プラグインはSlurmジョブステップで使用するように設計されていることに注意してください。Slurmジョブで使用するために設計されたjob_containerプラグインがあります。

Slurm process tracking plugins are Slurm plugins that implement the Slurm process tracking API described herein. They must conform to the Slurm Plugin API with the following specifications:
Slurmプロセス追跡プラグインは、ここで説明するSlurmプロセス追跡APIを実装するSlurmプラグインです。これらは、次の仕様のSlurm Plugin APIに準拠している必要があります。

const char plugin_type[]
The major type must be "proctrack." The minor type can be any recognizable abbreviation for the type of proctrack. We recommend, for example:
主なタイプは「proctrack」でなければなりません。マイナータイプは、proctrackのタイプの認識可能な省略形です。たとえば、次のことをお勧めします。

  • cray_aries — Use Cray XC job containers.
    cray_aries — Cray XCジョブコンテナーを使用します。
  • cgroup — Use Linux cgroups for process tracking. This is the recommended mechanism for non CRAY systems.
    cgroup —プロセス追跡にLinux cgroupを使用します。これは非CRAYシステムに推奨されるメカニズムです。
  • linuxproc — Perform process tracking based upon a scan of the Linux process table and use the parent process ID to determine what processes are members of a Slurm job. NOTE: This mechanism is not entirely reliable for process tracking.
    linuxproc — Linuxプロセステーブルのスキャンに基づいてプロセストラッキングを実行し、親プロセスIDを使用して、Slurmジョブのメンバーであるプロセスを特定します。注:このメカニズムは、プロセス追跡に対して完全に信頼できるわけではありません。
  • pgid — Use process group ID to determine what processes are members of a Slurm job. NOTE: This mechanism is not entirely reliable for process tracking.
    pgid —プロセスグループIDを使用して、Slurmジョブのメンバーであるプロセスを判別します。注:このメカニズムは、プロセス追跡に対して完全に信頼できるわけではありません。

const char plugin_name[]
Some descriptive name for the plugin. There is no requirement with respect to its format.
プラグインの説明的な名前。その形式に関して要件はありません。

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関数の変更が原因で障害を診断することが困難になる場合があります。

The programmer is urged to study src/plugins/proctrack/pgid/proctrack_pgid.c for an example implementation of a Slurm proctrack plugin.
プログラマーは、slurm proctrackプラグインの実装例について、src / plugins / proctrack / pgid / proctrack_pgid.cを調べることをお勧めします。

Data Objects

The implementation must support a container id of type uint64_t. This container ID is maintained by the plugin directly in the slurmd job structure using the field named cont_id.
実装は、タイプuint64_tのコンテナーIDをサポートする必要があります。このコンテナーIDは、cont_idという名前のフィールドを使用して、プラグインによってslurmdジョブ構造に直接保持されます。

The implementation must maintain (though not necessarily directly export) an enumerated errno to allow Slurm to discover as practically as possible the reason for any failed API call.
実装は、列挙されたerrnoを維持する必要があります(必ずしも直接エクスポートする必要はありません)。これにより、Slurmは、API呼び出しの失敗の理由を可能な限り実用的に発見できます。
These values must not be used as return values in integer-valued functions in the API.
これらの値は、APIの整数値関数の戻り値として使用しないでください。
The proper error return value from integer-valued functions is SLURM_ERROR. The implementation should endeavor to provide useful and pertinent information by whatever means is practical. Successful API calls are not required to reset errno to a known value.
整数値関数からの適切なエラー戻り値はSLURM_ERRORです。実装は、実用的であるどんな手段によっても有用で適切な情報を提供するよう努めるべきです。errnoを既知の値にリセットするために、成功したAPI呼び出しは必要ありません。

API Functions

The following functions must appear. Functions which are not implemented should 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()の前に呼び出されます。

int proctrack_p_create (stepd_step_rec_t *job);

Description: Create a container. The caller should ensure that be valid proctrack_p_destroy() is called. This function must put the container ID directory in the job structure's variable cont_id.
説明:コンテナを作成します。呼び出し元は、有効なproctrack_p_destroy()が呼び出されることを確認する必要があります。この関数は、コンテナーIDディレクトリーをジョブ構造の変数cont_idに配置する必要があります。

Argument: job    (input/output) Pointer to a slurmd job structure.
引数:job(入力/出力)slurmdジョブ構造へのポインター。

Returns: SLURM_SUCCESS if successful. On failure, the plugin should return SLURM_ERROR and set the errno to an appropriate value to indicate the reason for failure.
戻り値:成功した場合はSLURM_SUCCESS。失敗すると、プラグインはSLURM_ERRORを返し、errnoを適切な値に設定して、失敗の理由を示す必要があります。

int proctrack_p_add (stepd_step_rec_t *job, pid_t pid);

Description: Add a specific process ID to a given job step's container.
説明:特定のプロセスIDを特定のジョブステップのコンテナーに追加します。

Arguments:
job    (input) Pointer to a slurmd job structure.
job(入力)slurmdジョブ構造へのポインター。

pid    (input) The ID of the process to add to this job's container.
pid(入力)このジョブのコンテナーに追加するプロセスのID。

Returns: SLURM_SUCCESS if successful. On failure, the plugin should return SLURM_ERROR and set the errno to an appropriate value to indicate the reason for failure.
戻り値:成功した場合はSLURM_SUCCESS。失敗すると、プラグインはSLURM_ERRORを返し、errnoを適切な値に設定して、失敗の理由を示す必要があります。

int proctrack_p_signal (uint64_t id, int signal);

Description: Signal all processes in a given job step container.
説明:特定のジョブステップコンテナー内のすべてのプロセスにシグナルを送信します。

Arguments:
id   (input) Job step container's ID.
id(入力)ジョブステップコンテナーのID。

signal   (input) Signal to be sent to processes. Note that a signal of zero just tests for the existence of processes in a given job step container.
signal(入力)プロセスに送信されるシグナル。ゼロの信号は、特定のジョブステップコンテナー内のプロセスの存在をテストするだけであることに注意してください。

Returns: SLURM_SUCCESS if the signal was sent. If the signal can not be sent, the function should return SLURM_ERROR and set its errno to an appropriate value to indicate the reason for failure.
戻り値:シグナルが送信された場合はSLURM_SUCCESS。シグナルを送信できない場合、関数はSLURM_ERRORを返し、errnoを適切な値に設定して、失敗の理由を示す必要があります。

int proctrack_p_destroy (uint64_t id);

Description: Destroy or otherwise invalidate a job step container. This does not imply the container is empty, just that it is no longer needed.
説明:ジョブステップコンテナーを破棄するか、無効にします。これは、コンテナーが空であるという意味ではなく、コンテナーが不要になったという意味です。

Arguments: id    (input) Job step container's ID.
引数:id(入力)ジョブステップコンテナーのID。

Returns: SLURM_SUCCESS if successful. On failure, the plugin should return SLURM_ERROR and set the errno to an appropriate value to indicate the reason for failure.
戻り値:成功した場合はSLURM_SUCCESS。失敗すると、プラグインはSLURM_ERRORを返し、errnoを適切な値に設定して、失敗の理由を示す必要があります。

uint64_t proctrack_p_find (pid_t pid);

Description: Given a process ID, return its job step container ID.
説明:プロセスIDを指定して、そのジョブステップコンテナーIDを返します。

Arguments: pid    (input) A process ID.
引数:pid(入力)プロセスID。

Returns: The job step container ID with this process or zero if none is found.
戻り値:このプロセスのジョブステップコンテナーID。見つからない場合はゼロ。

uint32_t proctrack_p_get_pids (uint64_t cont_id, pid_t **pids, int *npids);

Description: Given a process container ID, fill in all the process IDs in the container.
説明:プロセスコンテナーIDを指定して、コンテナー内のすべてのプロセスIDを入力します。

Arguments: cont_id    (input) A job step container ID.
cont_id(入力)ジョブステップのコンテナーID。

pids    (output) Array of process IDs in the container.
pids(出力)コンテナー内のプロセスIDの配列。

npids    (output) Count of process IDs in the container.
npids(出力)コンテナー内のプロセスIDの数。

Returns: SLURM_SUCCESS if successful, SLURM_ERROR else.

Last modified 14 January 2019