1Slurm API(3)           Slurm job step context functions           Slurm API(3)
2
3
4

NAME

6       slurm_step_ctx_create,                  slurm_step_ctx_create_no_alloc,
7       slurm_step_ctx_daemon_per_node_hack,                slurm_step_ctx_get,
8       slurm_step_ctx_params_t_init,  slurm_jobinfo_ctx_get, slurm_spawn_kill,
9       slurm_step_ctx_destroy - Slurm task spawn functions
10
11

SYNTAX

13       #include <slurm/slurm.h>
14
15       slurm_step_ctx slurm_step_ctx_create (
16            slurm_step_ctx_params_t *step_req
17       );
18
19       slurm_step_ctx slurm_step_ctx_create_no_alloc (
20            slurm_step_ctx_params_t *step_req
21       );
22
23       int slurm_step_ctx_daemon_per_node_hack (
24            slurm_step_ctx_t *ctx
25       );
26
27       int slurm_step_ctx_get (
28            slurm_step_ctx_t *ctx,
29            int ctx_key,
30            ...
31       );
32
33       int slurm_jobinfo_ctx_get (
34            switch_jobinfo_t jobinfo,
35            int data_type,
36            void *data
37       );
38
39       void slurm_step_ctx_params_t_init (
40            slurm_step_ctx_params_t *step_req
41       );
42
43       int slurm_spawn {
44            slurm_step_ctx ctx,
45            int *fd_array
46       );
47
48       int slurm_spawn_kill {
49               slurm_step_ctx ctx,
50            uint16_t signal
51       );
52
53       int slurm_step_ctx_destroy {
54            slurm_step_ctx ctx
55       );
56

ARGUMENTS

58       step_req
59              Specifies the pointer to the structure  with  job  step  request
60              specification.  See  slurm.h for full details on the data struc‐
61              ture's contents.
62
63       ctx    Job  step  context.   Created   by   slurm_step_ctx_create,   or
64              slurm_step_ctx_create_no_alloc   used   in  subsequent  function
65              calls, and destroyed by slurm_step_ctx_destroy.
66
67       ctx_key
68              Identifies   the   fields   in   ctx   to   be   collected    by
69              slurm_step_ctx_get.
70
71       data   Storage location for requested data. See data_type below.
72
73       data_type
74              Switch-specific data requested. The interpretation of this field
75              depends upon the switch plugin in use.
76
77       fd_array
78              Array of socket file descriptors to be connected to  the  initi‐
79              ated  tasks.   Tasks will be connected to these file descriptors
80              in order of their task id.   This  socket  will  carry  standard
81              input,  output  and error for the task.  jobinfo Switch-specific
82              job information as returned by slurm_step_ctx_get.
83
84       signal Signal to be sent to the spawned tasks.
85

DESCRIPTION

87       slurm_jobinfo_ctx_get Get values from a jobinfo field  as  returned  by
88       slurm_step_ctx_get.  The operation of this function is highly dependent
89       upon the switch plugin in use.
90
91       slurm_step_ctx_create Create a job step context. To avoid memory  leaks
92       call  slurm_step_ctx_destroy  when the use of this context is finished.
93       NOTE: this function creates a slurm job step.  Call  slurm_spawn  in  a
94       timely  fashion  to  avoid  having  job  step  credentials time out. If
95       slurm_spawn is not used, explicitly cancel the job step.
96
97       slurm_step_ctx_create_no_alloc Same as above,  only  no  allocation  is
98       made. To avoid memory leaks call slurm_step_ctx_destroy when the use of
99       this context is finished.
100
101       slurm_step_ctx_daemon_per_node_hack Hack the step context to run a sin‐
102       gle   process   per  node,  regardless  of  the  settings  selected  at
103       slurm_step_ctx_create time.
104
105       slurm_step_ctx_get Get values from a job step context.  ctx_key identi‐
106       fies  the  fields to be gathered from the job step context.  Subsequent
107       arguments to this function are dependent upon the value of ctx_key. See
108       the CONTEXT KEYS section for details.
109
110       slurm_step_ctx_params_t_init  This initializes parameters in the struc‐
111       ture that you will pass to slurm_step_ctx_create().
112
113       slurm_spawn Spawn tasks based upon a job  step  context  and  establish
114       communications  with the tasks using the socket file descriptors speci‐
115       fied.  Note that this function can only be called  once  for  each  job
116       step  context.   Establish a new job step context for each set of tasks
117       to be spawned.
118
119       slurm_spawn_kill  Signal  the  tasks  spawned  for  this   context   by
120       slurm_spawn.
121
122       slurm_step_ctx_destroy   Destroy   a   job   step  context  created  by
123       slurm_step_ctx_create.
124

CONEXT KEYS

126       SLURM_STEP_CTX_ARGS
127              Set the argument count and values for the  executable.   Accepts
128              two  additional  arguments, the first of type int and the second
129              of type char **.
130
131       SLURM_STEP_CTX_CHDIR
132              Have the remote process change directory to the specified  loca‐
133              tion  before  beginning  execution. Accepts one argument of type
134              char * identifying the  directory's  pathname.  By  default  the
135              remote  process will execute in the same directory pathname from
136              which it is spawned. NOTE:  This  assumes  that  same  directory
137              pathname exists on the other nodes.
138
139       SLURM_STEP_CTX_ENV
140              Sets  the  environment  variable  count  and values for the exe‐
141              cutable.  Accepts two additional arguments, the  first  of  type
142              int and the second of type char **. By default the current envi‐
143              ronment variables are copied to started task's environment.
144
145       SLURM_STEP_CTX_RESP
146              Get the job step response message.  Accepts one additional argu‐
147              ment of type job_step_create_response_msg_t **.
148
149       SLURM_STEP_CTX_STEPID
150              Get the step id of the created job step.  Accepts one additional
151              argument of type uint32_t *.
152
153       SLURM_STEP_CTX_TASKS
154              Get the number of tasks per node for a given job.   Accepts  one
155              additional  argument of type uint32_t **.  This argument will be
156              set to point to an array with the task counts of each node in an
157              element of the array.  See SLURM_STEP_CTX_TID below to determine
158              the task ID numbers associated with each of those tasks.
159
160       SLURM_STEP_CTX_TID
161              Get the task ID numbers associated with the tasks allocated to a
162              specific  node.   Accepts two additional arguments, the first of
163              type int and the second of type uint32_t **. The first  argument
164              identifies the node number of interest (zero origin). The second
165              argument will be set to point to an array with the task ID  num‐
166              bers of each task allocated to the node (also zero origin).  See
167              SLURM_STEP_CTX_TASKS above to determine how many tasks are asso‐
168              ciated with each node.
169

RETURN VALUE

171       For   slurm_step_ctx_create  a context is return upon success. On error
172       NULL is returned and the Slurm error code is set appropriately.
173
174       For all other functions zero is returned upon success.  On error, -1 is
175       returned, and the Slurm error code is set appropriately.
176

ERRORS

178       EINVAL Invalid argument
179
180       SLURM_PROTOCOL_VERSION_ERROR Protocol version has changed, re-link your
181       code.
182
183       ESLURM_INVALID_JOB_ID the requested job id does not exist.
184
185       ESLURM_ALREADY_DONE the specified job has already completed and can not
186       be modified.
187
188       ESLURM_ACCESS_DENIED  the  requesting  user lacks authorization for the
189       requested action (e.g. trying to delete or modify another user's job).
190
191       ESLURM_DISABLED the ability to create a job step is currently disabled.
192       This  is  indicative  of  the  job  being  suspended. Retry the call as
193       desired.
194
195       ESLURM_INTERCONNECT_FAILURE failed to configure the node interconnect.
196
197       ESLURM_BAD_DIST task distribution specification is invalid.
198
199       SLURM_PROTOCOL_SOCKET_IMPL_TIMEOUT Timeout in communicating with  Slurm
200       controller.
201

EXAMPLE

203       SEE slurm_step_launch(3) man page for an example of slurm_step_ctx_cre‐
204       ate and slurm_step_launch in use together.
205
206

NOTE

208       These functions are included in the libslurm  library,  which  must  be
209       linked to your process for use (e.g. "cc -lslurm myprog.c").
210
211

COPYING

213       Copyright  (C)  2004-2007  The Regents of the University of California.
214       Produced at Lawrence Livermore National  Laboratory  (cf,  DISCLAIMER).
215       CODE-OCEC-09-009. All rights reserved.
216
217       This  file  is  part  of  Slurm,  a  resource  management program.  For
218       details, see <https://slurm.schedmd.com/>.
219
220       Slurm is free software; you can redistribute it and/or modify it  under
221       the  terms  of  the GNU General Public License as published by the Free
222       Software Foundation; either version 2  of  the  License,  or  (at  your
223       option) any later version.
224
225       Slurm  is  distributed  in the hope that it will be useful, but WITHOUT
226       ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY  or
227       FITNESS  FOR  A PARTICULAR PURPOSE.  See the GNU General Public License
228       for more details.
229

SEE ALSO

231       slurm_allocate_resources(3),                  slurm_job_step_create(3),
232       slurm_kill_job(3),   slurm_get_errno(3),   slurm_perror(3),  slurm_str‐
233       error(3), srun(1)
234
235
236
237April 2015             Slurm job step context functions           Slurm API(3)
Impressum