~ubuntu-branches/ubuntu/vivid/slurm-llnl/vivid

« back to all changes in this revision

Viewing changes to slurm/spank.h

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2009-09-24 23:28:15 UTC
  • mfrom: (1.1.11 upstream) (3.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090924232815-enh65jn32q1ebg07
Tags: 2.0.5-1
* New upstream release 
* Changed dependecy from lib-mysqlclient15 to lib-mysqlclient 
* Added Default-Start for runlevel 2 and 4 and $remote_fs requirement in
  init.d scripts (Closes: #541252)
* Postinst checks for wrong runlevels 2 and 4 links
* Upgraded to standard version 3.8.3
* Add lintian overrides for missing slurm-llnl-configurator.html in doc
  base registration
* modified postrm scripts to ignore pkill return value in order to avoid
  postrm failure when no slurm process is running
* Checking for slurmctld.pid before cancelling running and pending
  jobs during package removal 

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 *  LLNL-CODE-402394.
 
7
 *  CODE-OCEC-09-009. All rights reserved.
8
8
 *  
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.
11
12
 *  
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
68
69
 *               `-> user_init ()  
69
70
 *               + for each task
70
71
 *               |       + fork ()
71
 
 *               |       `-> user_task_init ()
 
72
 *               |       |
 
73
 *               |       + reclaim privileges
 
74
 *               |       `-> task_init_privileged ()
 
75
 *               |       |
 
76
 *               |       + become_user ()
 
77
 *               |       `-> task_init ()
 
78
 *               |       |
72
79
 *               |       + execve ()
73
80
 *               |
74
81
 *               + reclaim privileges
78
85
 *               + for each task
79
86
 *               |       + wait ()
80
87
 *               |          `-> task_exit ()
81
 
 *               `-> fini ()
82
 
 *
83
 
 *   In srun only the init() and local_user_init() callbacks are used.
 
88
 *               `-> exit ()
 
89
 *
 
90
 *   In srun only the init(), init_post_opt() and local_user_init(), and exit()
 
91
 *    callbacks are used.
 
92
 *
 
93
 *   In sbatch/salloc only the init(), init_post_opt(), and exit() callbacks
 
94
 *    are used.
84
95
 *
85
96
 */
86
97
 
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   */
158
171
};
159
172
 
160
173
typedef enum spank_err spank_err_t;
161
174
 
162
175
/*
 
176
 *  SPANK plugin context
 
177
 */
 
178
enum spank_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)            */
 
183
};
 
184
 
 
185
typedef enum spank_context spank_context_t;
 
186
 
 
187
/*
163
188
 *  SPANK plugin options
164
189
 */
165
190
 
182
207
};
183
208
 
184
209
/*
185
 
 *  Plugin may declare spank_options option table:
186
 
 *   [Note: options may also be declared with spank_option_register(),
187
 
 *    defined below.]
 
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.
188
214
 */
189
215
extern struct spank_option spank_options [];
190
216
 
204
230
BEGIN_C_DECLS
205
231
 
206
232
/*
 
233
 *  Return the string representation of a spank_err_t error code.
 
234
 */
 
235
const char *spank_strerror (spank_err_t err);
 
236
 
 
237
/*
207
238
 *  Determine whether a given spank plugin symbol is supported
208
239
 *   in this version of SPANK interface.
209
240
 *
215
246
int spank_symbol_supported (const char *symbol);
216
247
 
217
248
/*
218
 
 *  Determine whether plugin is loaded "local" or "remote."
 
249
 *  Determine whether plugin is loaded in "remote" context
219
250
 * 
220
251
 *  Returns:
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.
224
255
 */
225
256
int spank_remote (spank_t spank);
226
257
 
227
258
/*
 
259
 *  Return the context in which the calling plugin is loaded.
 
260
 *
 
261
 *  Returns the spank_context for the calling plugin, or SPANK_CTX_ERROR
 
262
 *   if the current context cannot be determined.
 
263
 */
 
264
spank_context_t spank_context (void);
 
265
 
 
266
/*
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).
 
271
 *
 
272
 *  This function is the only method to register options in
 
273
 *   allocator context.
 
274
 *
 
275
 *  May be called multiple times to register many options.
232
276
 *
233
277
 *  Returns ESPANK_SUCCESS on successful registration of the option
234
278
 *   or ESPANK_BAD_ARG if not called from slurm_spank_init().