4
4
* Copyright (C) 2002-2007 The Regents of the University of California.
5
5
* Copyright (C) 2008 Lawrence Livermore National Security.
6
6
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
7
* CODE-OCEC-09-009. All rights reserved.
9
9
* This file is part of SLURM, a resource management program.
10
* For details, see <http://www.llnl.gov/linux/slurm/>.
10
* For details, see <https://computing.llnl.gov/linux/slurm/>.
11
* Please also read the included file: DISCLAIMER.
12
13
* SLURM is free software; you can redistribute it and/or modify it under
13
14
* the terms of the GNU General Public License as published by the Free
80
87
* | `-> task_exit ()
83
* In srun only the init() and local_user_init() callbacks are used.
90
* In srun only the init(), init_post_opt() and local_user_init(), and exit()
93
* In sbatch/salloc only the init(), init_post_opt(), and exit() callbacks
88
99
extern spank_f slurm_spank_init_post_opt;
89
100
extern spank_f slurm_spank_local_user_init;
90
101
extern spank_f slurm_spank_user_init;
102
extern spank_f slurm_spank_task_init_privileged;
91
103
extern spank_f slurm_spank_task_init;
92
104
extern spank_f slurm_spank_task_post_fork;
93
105
extern spank_f slurm_spank_task_exit;
154
166
ESPANK_NOSPACE = 6, /* Buffer too small. */
155
167
ESPANK_NOT_REMOTE = 7, /* Function only may be called in remote context */
156
168
ESPANK_NOEXIST = 8, /* Id/pid doesn't exist on this node */
157
ESPANK_NOT_EXECD = 9 /* Lookup by pid requested, but no tasks running */
169
ESPANK_NOT_EXECD = 9, /* Lookup by pid requested, but no tasks running */
170
ESPANK_NOT_AVAIL = 10,/* SPANK item not available from this callback */
160
173
typedef enum spank_err spank_err_t;
176
* SPANK plugin context
179
S_CTX_ERROR, /* Error obtaining current context */
180
S_CTX_LOCAL, /* Local context (srun) */
181
S_CTX_REMOTE, /* Remote context (slurmd) */
182
S_CTX_ALLOCATOR /* Allocator context (sbatch/salloc) */
185
typedef enum spank_context spank_context_t;
163
188
* SPANK plugin options
185
* Plugin may declare spank_options option table:
186
* [Note: options may also be declared with spank_option_register(),
210
* Plugins may export a spank_options option table as symbol "spank_options".
211
* This method only works in "local" and "remote" mode. To register options
212
* in "allocator" mode (sbatch/salloc), use the preferred
213
* spank_option_register function described below.
189
215
extern struct spank_option spank_options [];
233
* Return the string representation of a spank_err_t error code.
235
const char *spank_strerror (spank_err_t err);
207
238
* Determine whether a given spank plugin symbol is supported
208
239
* in this version of SPANK interface.
215
246
int spank_symbol_supported (const char *symbol);
218
* Determine whether plugin is loaded "local" or "remote."
249
* Determine whether plugin is loaded in "remote" context
221
252
* = 1 remote context, i.e. plugin is loaded in slurmd.
222
* = 0 local context, i.e. plugin loaded in srun.
253
* = 0 not remote context
223
254
* < 0 spank handle was not valid.
225
256
int spank_remote (spank_t spank);
259
* Return the context in which the calling plugin is loaded.
261
* Returns the spank_context for the calling plugin, or SPANK_CTX_ERROR
262
* if the current context cannot be determined.
264
spank_context_t spank_context (void);
228
267
* Register a plugin-provided option dynamically. This function
229
268
* is only valid when called from slurm_spank_init(), and must
230
* be called in both remote (slurmd) and local (srun) contexts.
231
* May be called multiple times to register many options.
269
* be guaranteed to be called in all contexts in which it is
270
* used (local, remote, allocator).
272
* This function is the only method to register options in
275
* May be called multiple times to register many options.
233
277
* Returns ESPANK_SUCCESS on successful registration of the option
234
278
* or ESPANK_BAD_ARG if not called from slurm_spank_init().