SPANK(8) Slurm Component SPANK(8) (NAME) SPANK - Slurm (Job and Node Control) (DESCRIPTION) Slurm (SPANK) SPANK ( : plugstack.conf) . SPANK (stackable) Slurm . SPANK Slurm . spank.h Slurm SPANK plugstack.conf . SPANK Slurm . : SPANK Slurm (major release) . API SPANK ABI . SPANK Slurm API Slurm . SPANK (SPANK PLUGINS) SPANK (context) Slurm . : local local srun ( <<>> ). remote remote slurmstepd ( <<>> ). allocator allocator salloc sbatch scrontab . slurmd slurmd slurmd . : slurmd slurmd slurmd . job_script job_script . : job_script slurmd . slurm_spank_job_prolog slurm_spank_job_epilog . local init exit init_post_opt local_user_init . allocator init exit init_post_opt . slurmd init slurmd_exit job_script job_prolog job_epilog . spank_context spank_remote spank.h . SPANK Slurm . : slurm_spank_init . remote (job step) . . slurm_spank_job_prolog . SPANK plugstack.conf (required) (drained) . slurm_spank_init_post_opt slurm_spank_init . init init_post_opt plugstack.conf init slurm_spank_init_post_opt . (heterogeneous job) slurm_spank_init . slurm_spank_local_user_init (srun) . (job ID) (step IDs) . srun . slurm_spank_user_init ( remote). slurm_spank_task_init_privileged fork . slurm_spank_task_post_fork ( remote). slurm_spank_task_init execve (2) . cgroups cgroup ( remote). slurm_spank_task_post_fork fork (2) . slurmd fork (2) (exec) . slurm_spank_task_init_privileged ( remote). slurm_spank_task_exit Slurm ( remote). slurm_spank_exit slurmstepd remote . local srun . slurm_spank_job_epilog . SPANK plugstack.conf (required) (drained) . slurm_spank_slurmd_exit slurmd . (prototype) : int slurm_spank_init (spank_t spank, int ac, char *argv[]) spank SPANK spank_get_item spank_getenv Slurm . ( (CONFIGURATION) ) argv ac . Slurm : slurm_spank_init_failure_mode slurm_spank_init Slurm . : ESPANK_NODE_FAILURE Slurm (drained) . (requeued). . ESPANK_JOB_FAILURE Slurm ( ). . SPANK slurm_spank (hook) . . spank_symbol_supported : int spank_symbol_supported (const char *sym); 1 0 . SPANK Slurm . spank_get_item . spank_err_t spank_get_item (spank_t spank, spank_item_t item, ...); spank_get_item SPANK spank_item_t . . item spank.h . : S_JOB_UID (User id) . (uid_t *) spank_get_item . S_JOB_STEPID (Job step id) . (uint32_t *) spank_get_item . S_TASK_EXIT_STATUS . slurm_spank_task_exit . (int *) spank_get_item . S_JOB_ARGV . spank_get_item (int *, char ***) . spank.h . SPANK local allocator getenv setenv unsetenv . SPANK remote spank_getenv spank_setenv spank_unsetenv . spank_getenv var buf len . spank_setenv SPANK spank_unsetenv . : spank_err_t spank_getenv (spank_t spank, const char *var, char *buf, int len); spank_err_t spank_setenv (spank_t spank, const char *var, const char *val, int overwrite); spank_err_t spank_unsetenv (spank_t spank, const char *var); remote setenv (3) getenv (3) unsetenv (3) local . SPANK (export) PrologSlurmctld Prolog Epilog EpilogSlurmctld Slurm ( job control). SPANK_ ( root Slurm ). local . spank_err_t spank_job_control_getenv(spank_t spank, const char *var, char *buf, int len); spank_err_t spank_job_control_setenv(spank_t spank, const char *var, const char *val, int overwrite); spank_err_t spank_job_control_unsetenv(spank_t spank, const char *var); spank.h . SPANK spank_err_t . ESPANK_SUCCESS spank.h . SPANK const char * spank_strerror(spank_err_t err); spank_err_t . slurm_spank_log . slurm_error "error:" . SPANK (SPANK OPTIONS) SPANK . Slurm srun(1) salloc(1) sbatch(1) . slurmd . SPANK Slurm . Slurm struct spank_option spank.h : struct spank_option { char * name; char * arginfo; char * usage; int has_arg; int val; spank_opt_cb_f cb; }; name . SPANK_OPTION_MAXLEN spank.h . arginfo . usage --help . has_arg 0 1 2 ( getopt_long (3) ). val . cb Slurm . spank_opt_cb_f spank.h : typedef int (*spank_opt_cb_f) (int val, const char *optarg, int remote); val val spank_option optarg ( ) remote <<>> ( srun sbatch/salloc ) 0 <<>> ( slurmd/slurmstepd ) 1 slurmstepd ( remote) . spank_option_register Slurm . slurm_spank_init . : spank_err_t spank_option_register (spank_t sp, struct spank_option *opt); ESPANK_SUCCESS ( spank_t slurm_spank_init ) ESPANK_BAD_ARG . . local (srun) remote (slurmd) spank_option_register : if (spank_context() != S_CTX_ALLOCATOR) spank_option_register (sp, opt); spank_option_register . spank_option_register struct spank_option spank_options Slurm . sbatch salloc ( allocator) spank_option_register . spank_options . SPANK_OPTIONS_TABLE_END spank.h . ( ) Slurm remote=0 . (sanity checking) . . spank . . SPANK spank_init . . spank_option_getopt . : spank_err_t spank_option_getopt(spank_t sp, struct spank_option *opt, char **optargp); struct spank_option opt ESPANK_SUCCESS . optargp (non-NULL) ( ). job_script (slurm_spank_job_prolog slurm_spank_job_epilog) . : slurm_spank_job_prolog slurm_spank_local_user_init slurm_spank_user_init slurm_spank_task_init_privileged slurm_spank_task_init slurm_spank_task_exit slurm_spank_job_epilog. (CONFIGURATION) SPANK plugstack.conf slurm.conf(5) PlugStackConfig Slurm . plugstack.conf . SPANK required () optional () . () '#' . . : SPANK slurmd ( ) salloc sbatch ( ) . : required/optional plugin arguments : optional /usr/lib/slurm/test.so slurmd test.so . SPANK required slurmd optional . (fully-qualified path) PluginDir slurm.conf(5) . SPANK (stackable) . optional . include plugstack.conf . include (glob) include . /etc/slurm/plugstack.conf.d : include /etc/slurm/plugstack.conf.d/* spank . SPANK . . (ERRORS) SPANK : +----------+-----------------------------------+------------+-----------+--------------+-----------+ |Command | Function | Context | Exitcode | Drains Node | Fails job | +----------+-----------------------------------+------------+-----------+--------------+-----------+ +----------+-----------------------------------+------------+-----------+--------------+-----------+ |srun | slurm_spank_init | local | 1 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |srun | slurm_spank_init_post_opt | local | 1 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |srun | slurm_spank_local_user_init | local | 1 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |srun | slurm_spank_init | remote | 1 | no | no | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |srun | slurm_spank_user_init | remote | 0 | no | no | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |srun | slurm_spank_task_init_privileged | remote | 1 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |srun | slurm_spank_task_post_fork | remote | 0 | no | no | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |srun | slurm_spank_task_init | remote | 1 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |srun | slurm_spank_task_exit | remote | 0 | no | no | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |srun | slurm_spank_exit | local | 0 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ +----------+-----------------------------------+------------+-----------+--------------+-----------+ |salloc | slurm_spank_init | allocator | 1 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |salloc | slurm_spank_init_post_opt | allocator | 1 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |salloc | slurm_spank_init | remote | 1 | no | no | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |salloc | slurm_spank_user_init | remote | 1 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |salloc | slurm_spank_task_init_privileged | remote | 1 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |salloc | slurm_spank_task_post_fork | remote | 1 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |salloc | slurm_spank_task_init | remote | 1 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |salloc | slurm_spank_task_exit | remote | 0 | no | no | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |salloc | slurm_spank_exit | allocator | 0 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ +----------+-----------------------------------+------------+-----------+--------------+-----------+ |sbatch | slurm_spank_init | allocator | 1 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |sbatch | slurm_spank_init_post_opt | allocator | 1 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |sbatch | slurm_spank_init | remote | 1 | yes | no | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |sbatch | slurm_spank_user_init | remote | 1 | yes | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |sbatch | slurm_spank_task_init_privileged | remote | 1 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |sbatch | slurm_spank_task_post_fork | remote | 1 | yes | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |sbatch | slurm_spank_task_init | remote | 1 | no | yes | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |sbatch | slurm_spank_task_exit | remote | 0 | no | no | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |sbatch | slurm_spank_exit | allocator | 0 | no | no | +----------+-----------------------------------+------------+-----------+--------------+-----------+ +----------+-----------------------------------+------------+-----------+--------------+-----------+ |scrontab | slurm_spank_init | allocator | 1 | no | no | +----------+-----------------------------------+------------+-----------+--------------+-----------+ |scrontab | slurm_spank_exit | allocator | 0 | no | no | +----------+-----------------------------------+------------+-----------+--------------+-----------+ : ProctrackType=proctrack/pgid slurm_spank_task_post_fork remote (timeout) . (COPYING) Portions copyright (C) 2010-2022 SchedMD LLC. Copyright (C) 2006 The Regents of the University of California. Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). CODE-OCEC-09-009. All rights reserved. Slurm . . Slurm (GNU General Public License) ( ) . Slurm . . (FILES) /etc/slurm/slurm.conf - Slurm. /etc/slurm/plugstack.conf - SPANK. /usr/include/slurm/spank.h - SPANK. (SEE ALSO) srun(1), slurm.conf(5) Slurm 26.05 Slurm Component SPANK(8)