Slurm Plugin API

Overview

A Slurm plugin is a dynamically linked code object which is loaded explicitly at run time by the Slurm libraries. A plugin provides a customized implementation of a well-defined API connected to tasks such as authentication, interconnect fabric, and task scheduling.
Slurmプラグインは、動的にリンクされたコードオブジェクトであり、実行時にSlurmライブラリによって明示的にロードされます。プラグインは、認証、相互接続ファブリック、タスクスケジューリングなどのタスクに接続された明確に定義されたAPIのカスタマイズされた実装を提供します。

Identification

A Slurm plugin identifies itself by a short character string formatted similarly to a MIME type: <major>/<minor>. The major type identifies which API the plugin implements. The minor type uniquely distinguishes a plugin from other plugins that implement that same API, by such means as the intended platform or the internal algorithm. For example, a plugin to interface to the Maui scheduler would give its type as "sched/maui." It would implement the Slurm Scheduler API.
Slurmプラグインは、MIMEタイプと同様にフォーマットされた短い文字列によって自身を識別します。 /。主要なタイプは、プラグインが実装するAPIを識別します。マイナータイプは、目的のプラットフォームや内部アルゴリズムなどの手段によって、同じAPIを実装する他のプラグインとプラグインを一意に区別します。たとえば、マウイスケジューラへのインターフェースを提供するプラグインは、そのタイプを「sched / maui」として指定します。Slurm Scheduler APIを実装します。

Versioning

Slurm plugin version numbers comprise a major, minor and micro revision number. If the major and/or minor revision number changes, this indicates major changes to the Slurm functionality including changes to APIs, command options, and plugins.
Slurmプラグインのバージョン番号は、メジャー、マイナー、マイクロのリビジョン番号で構成されています。メジャーおよび/またはマイナーリビジョン番号が変更された場合、これは、API、コマンドオプション、プラグインの変更を含む、Slurm機能へのメジャー変更を示します。
These plugin changes may include new functions and/or function arguments. If only the micro revision number changes, this is indicative of bug fixes and possibly minor enhancements which should not adversely impact users. In all cases, rebuilding and installing all Slurm plugins is recommended at upgrade time.
これらのプラグインの変更には、新しい関数や関数の引数が含まれる場合があります。マイクロリビジョン番号のみが変更されている場合、これはバグの修正と、ユーザーに悪影響を与えてはならないマイナーな機能強化を示しています。いずれの場合も、アップグレード時にはすべてのSlurmプラグインを再ビルドしてインストールすることをお勧めします。
Not all compute nodes in a cluster need be updated at the same time, but all Slurm APIs, commands, plugins, etc. on a compute node should represent the same version of Slurm.
クラスター内のすべての計算ノードを同時に更新する必要はありませんが、計算ノード上のすべてのSlurm API、コマンド、プラグインなどは、同じバージョンのSlurmを表す必要があります。

Data Objects

A plugin must define and export the following symbols:

  • char plugin_type[]
    a unique, short, formatted string to identify the plugin's purpose as described above. A "null" plugin (i.e., one that implements the desired API as stubs) should have a minor type of "none."
    上で説明したように、プラグインの目的を識別するための一意で短い形式の文字列。「null」プラグイン(つまり、必要なAPIをスタブとして実装するプラグイン)には、マイナータイプの「none」が必要です。
  • char plugin_name[]
    a free-form string that identifies the plugin in human-readable terms, such as "Kerberos authentication." Slurm will use this string to identify the plugin to end users.
    「Kerberos認証」など、人間が読める用語でプラグインを識別する自由形式の文字列。Slurmはこの文字列を使用して、エンドユーザーにプラグインを識別します。

A plugin may optionally define and export the following symbols:
プラグインは、オプションで以下のシンボルを定義およびエクスポートできます。

  • 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関数の変更が原因で、障害の診断が困難になる可能性があります。

API Functions in All Plugins

int init (void);

Description: If present, this function is called just after the plugin is loaded. This allows the plugin to perform any global initialization prior to any actual API calls.
説明:存在する場合、この関数はプラグインがロードされた直後に呼び出されます。これにより、プラグインは実際のAPI呼び出しの前にグローバル初期化を実行できます。

Arguments: None.

Returns: SLURM_SUCCESS if the plugin's initialization was successful. Any other return value indicates to Slurm that the plugin should be unloaded and not used.
戻り値:プラグインの初期化が成功した場合はSLURM_SUCCESS。その他の戻り値は、プラグインをアンロードして使用しないようにSlurmに指示します。

void fini (void);

Description: If present, this function is called just before the plugin is unloaded. This allows the plugin to do any finalization after the last plugin-specific API call is made.
説明:存在する場合、この関数はプラグインがアンロードされる直前に呼び出されます。これにより、最後のプラグイン固有のAPI呼び出しが行われた後、プラグインはすべてのファイナライズを実行できます。

Arguments: None.

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()の前に呼び出されます。

The functions need not appear. The plugin may provide either init() or fini() or both.
関数は表示する必要はありません。プラグインは、init()またはfini()のいずれか、あるいはその両方を提供します。

Thread Safety

Slurm is a multithreaded application. The Slurm plugin library may exercise the plugin functions in a re-entrant fashion. It is the responsibility of the plugin author to provide the necessarily mutual exclusion and synchronization in order to avoid the pitfalls of re-entrant code.
Slurmはマルチスレッドアプリケーションです。Slurmプラグインライブラリは、リエントラントな方法でプラグイン機能を実行できます。再入可能コードの落とし穴を回避するために必然的に相互排除と同期を提供することは、プラグイン作成者の責任です。

Run-time Support

The standard system libraries are available to the plugin. The Slurm libraries are also available and plugin authors are encouraged to make use of them rather than develop their own substitutes. Plugins should use the Slurm log to print error messages.
標準システムライブラリはプラグインで利用できます。Slurmライブラリも利用可能であり、プラグインの作成者は、独自の代替物を開発するのではなく、それらを利用することをお勧めします。プラグインはSlurmログを使用してエラーメッセージを出力する必要があります。

The plugin author is responsible for specifying any specific non-standard libraries needed for correct operation. Plugins will not load if their dependent libraries are not available, so it is the installer's job to make sure the specified libraries are available.
プラグインの作成者は、正しい操作に必要な特定の非標準ライブラリを指定する責任があります。依存ライブラリが利用できない場合、プラグインはロードされません。そのため、指定されたライブラリが利用可能であることを確認するのはインストーラーの仕事です。

Performance

All plugin functions are expected to execute very quickly. If any function entails delays (e.g. transactions with other systems), it should be written to utilize a thread for that functionality. This thread may be created by the init() function and deleted by the fini() functions. See plugins/sched/backfill for an example of how to do this.
すべてのプラグイン関数は非常に迅速に実行されることが期待されています。関数が遅延を伴う場合(他のシステムとのトランザクションなど)、その機能のためにスレッドを利用するように記述する必要があります。このスレッドは、init()関数によって作成され、fini()関数によって削除されます。これを行う方法の例については、plugins / sched / backfillを参照してください。

Data Structure Consistency

In certain situations Slurm iterates over different data structures elements using counters. For example, with environment variable arrays. In order to avoid buffer overflows and other undesired situations, when a plugin modifies certain elements it must also update these counters accordingly. Other situations may require other types of changes.
特定の状況では、Slurmはカウンターを使用してさまざまなデータ構造要素を反復処理します。たとえば、環境変数配列を使用します。バッファオーバーフローやその他の望ましくない状況を回避するために、プラグインが特定の要素を変更するとき、それに応じてこれらのカウンタも更新する必要があります。他の状況では、他のタイプの変更が必要になる場合があります。

The following advice indicates which structures have arrays with associated counters that must be maintained when modifying data, plus other possible important information to take in consideration when manipulating these structures.
次のアドバイスは、データを変更するときに維持する必要のある関連するカウンターを持つ配列と、これらの構造体を操作するときに考慮すべきその他の重要な情報を持つ構造体を示しています。
This list is not fully exhaustive due to constant modifications in code, but it is a first start point and basic guideline for most common situations. Complete structure information can be seen in the slurm/slurm.h.in file.
このリストは、コードを常に変更しているため完全ではありませんが、最も一般的な状況の最初の出発点であり、基本的なガイドラインです。完全な構造情報は、slurm / slurm.h.inファイルで確認できます。

slurm_job_info_t (job_info_t) Data Structure

  uint32_t env_size;
  char **environment;

  uint32_t spank_job_env_size;
  char **spank_job_env;

  uint32_t gres_detail_cnt;
  char **gres_detail_str;

These pairs of array pointers and element counters must kept updated in order to avoid subsequent buffer overflows, so if you update the array you must also update the related counter.
これらの配列ポインターと要素カウンターのペアは、後続のバッファーオーバーフローを回避するために更新されたままにする必要があるため、配列を更新する場合は、関連するカウンターも更新する必要があります。

  char *nodes;
  int32_t *node_inx;

  int32_t *req_node_inx;
  char *req_nodes;

node_inx and req_node_inx represents a list of index pairs for ranges of nodes defined in the nodes and req_nodes fields respectively. In each case, both array variables must match the count.
node_inxおよびreq_node_inxは、それぞれnodeおよびreq_nodesフィールドで定義されたノードの範囲のインデックスペアのリストを表します。どちらの場合も、両方の配列変数がカウントと一致する必要があります。

  uint32_t het_job_id;
  char *het_job_id_set;

The het_job_id field should be the first element of the het_job_id_set array.
het_job_idフィールドは、het_job_id_set配列の最初の要素である必要があります。

job_step_info_t Data Structure

  char *nodes;
  int32_t *node_inx;

node_inx represents a list of index pairs for range of nodes defined in nodes. Both variables must match the node count.
node_inxは、nodesで定義されたノードの範囲のインデックスペアのリストを表します。両方の変数がノード数と一致する必要があります。

priority_factors_object_t Data Structure

  uint32_t tres_cnt;
  char **tres_names;
  double *tres_weights;

This value must match the configured TRES on the system, otherwise iteration over the tres_names or tres_weights arrays can cause buffer overflows.
この値は、システムで構成されたTRESと一致する必要があります。一致しない場合、tres_namesまたはtres_weights配列の反復により、バッファオーバーフローが発生する可能性があります。

job_step_pids_t Data Structure

  uint32_t pid_cnt;
  uint32_t *pid;

Array pid represents the list of Process IDs for the job step, and pid_cnt is the counter that must match the size of the array.
配列pidはジョブステップのプロセスIDのリストを表し、pid_cntは配列のサイズと一致する必要があるカウンターです。

slurm_step_layout_t Data Structure

  uint32_t node_cnt;
  char *node_list;

The node_list array size must match node_cnt.
node_list配列のサイズは、node_cntと一致する必要があります。

  uint16_t *tasks;
  uint32_t node_cnt;
  uint32_t task_cnt;

In the tasks array, each element is the number of tasks assigned to the corresponding node, to its size must match node_cnt. Moreover task_cnt represents the sum of tasks registered in tasks.
tasks配列では、各要素は対応するノードに割り当てられたタスクの数であり、そのサイズはnode_cntと一致する必要があります。また、task_cntは、tasksに登録されているタスクの合計を表します。

  uint32_t **tids;

tids is an array of length node_cnt of task ID arrays. Each subarray is designated by the corresponding value in the tasks array, so tasks, tids and task_cnt must be set to match this layout.
tidsは、タスクID配列の長さnode_cntの配列です。各サブ配列は、tasks配列の対応する値によって指定されるため、tasks、tids、およびtask_cntは、このレイアウトに一致するように設定する必要があります。

slurm_step_launch_params_t Data Structure

  uint32_t envc;
  char **env;

When modifying the environment variables in the env array, you must also modify the envc counter accordingly to prevent buffer overflows in subsequent loops over that array.
env配列の環境変数を変更する場合は、それに応じてenvcカウンターも変更して、その配列に対する後続のループでのバッファーオーバーフローを防止する必要があります。

  uint32_t het_job_nnodes;
  uint32_t het_job_ntasks;

  uint16_t *het_job_task_cnts;
  uint32_t **het_job_tids;
  uint32_t *het_job_node_list;

This het_job_* related variables must match the current heterogeneous job configuration.
このhet_job_ *関連変数は、現在の異種ジョブ構成と一致する必要があります。

For example, if for whatever reason you are reducing the number of tasks for a node in a heterogeneous job, you should at least remove that task ID from het_job_tids, decrement het_job_ntasks and het_job_task_cnts, and possibly decrement the number of nodes of the heterogeneous job in het_job_nnodes and het_job_node_list.
たとえば、何らかの理由で異種ジョブのノードのタスク数を減らす場合は、少なくともhet_job_tidsからそのタスクIDを削除し、het_job_ntasksとhet_job_task_cntsをデクリメントし、場合によっては、異種ジョブのノード数をデクリメントする必要があります。 het_job_nnodesおよびhet_job_node_list。

  char **spank_job_env;
  uint32_t spank_job_env_size;

When modifying the spank_job_env structure, the spank_job_env_size field must be updated to prevent buffer overflows in subsequent loops over that array.
spank_job_env構造体を変更するときは、spank_job_env_sizeフィールドを更新して、その配列に対する後続のループでのバッファオーバーフローを防止する必要があります。

node_info_t Data Structure

  char *features;
  char *features_act;

In a system containing Intel KNL processors the features_act field is set by the plugin to match the currently running modes on the node. On other systems the features_act is not usually used. If you program such a plugin you must ensure that features_act contains a subset of features.
インテルKNLプロセッサを含むシステムでは、ノードで現在実行されているモードに一致するようにfeatures_actフィールドがプラグインによって設定されます。他のシステムでは、features_actは通常使用されません。そのようなプラグインをプログラムする場合は、features_actに機能のサブセットが含まれていることを確認する必要があります。

char *reason;
time_t reason_time;
uint32_t reason_uid;

If reason is modified then reason_time and reason_uid should be updated.
理由が変更された場合は、reason_timeおよびreason_uidを更新する必要があります。

reserve_info_t Data Structure

  int32_t *node_inx;
  uint32_t node_cnt;

node_inx represents a list of index pairs for range of nodes associated with the reservation and its count must equal node_cnt.
node_inxは、予約に関連付けられたノードの範囲のインデックスペアのリストを表し、その数はnode_cntと等しくなければなりません。

partition_info_t Data Structure

No special advice.

slurm_step_layout_req_t Data Structure

No special advice.

slurm_step_ctx_params_t

No special advice.

Last modified 20 January 2020