1Slurm API(3) Slurm job step information functions Slurm API(3)
2
3
4
6 slurm_free_job_step_info_response_msg, slurm_get_job_steps,
7 slurm_print_job_step_info, slurm_print_job_step_info_msg - Slurm job
8 step information reporting functions
9
10
12 #include <stdio.h>
13 #include <slurm/slurm.h>
14
15 void slurm_free_job_step_info_response_msg (
16 job_step_info_response_msg_t *job_step_info_msg_ptr
17 );
18
19 void slurm_get_job_steps (
20 time_t *update_time,
21 uint32_t job_id,
22 uint32_t step_id,
23 job_step_info_response_msg_t **job_step_info_msg_pptr,
24 uint16_t show_flags
25 );
26
27 void slurm_print_job_step_info (
28 FILE *out_file,
29 job_step_info_t *job_step_ptr,
30 int one_liner
31 );
32
33 void slurm_print_job_step_info_msg (
34 FILE *out_file,
35 job_step_info_response_msg_t *job_step_info_msg_ptr,
36 int one_liner
37 );
38
40 job_id Specifies a slurm job ID. A value of zero implies all jobs.
41
42 job_step_info_msg_pptr
43 Specifies the double pointer to the structure to be created and
44 filled with the time of the last node update, a record count,
45 and detailed information about each job step specified. Detailed
46 job step information is written to fixed sized records and
47 includes: job_id, step_id, node names, etc. See slurm.h for full
48 details on the data structure's contents.
49
50 job_step_info_msg_ptr
51 Specifies the pointer to the structure created by the function
52 slurm_get_job_steps.
53
54 job_step_ptr
55 Specifies a pointer to a single job step records from the
56 job_step_info_msg_pptr data structure.
57
58 one_liner
59 Print one record per line if non-zero.
60
61 out_file
62 Specifies the file to print data to.
63
64 show_flags
65 Job filtering flags, may be ORed. Information about job steps
66 in partitions that are configured as hidden and partitions that
67 the user's group is unable to utilize are not reported by
68 default. The SHOW_ALL flag will cause information about job
69 steps in all partitions to be displayed.
70
71
72 step_id
73 Specifies a slurm job step ID. A value of zero implies all job
74 steps.
75
76 update_time
77 For all of the following informational calls, if update_time is
78 equal to or greater than the last time changes where made to
79 that information, new information is not returned. Otherwise
80 all the configuration. job, node, or partition records are
81 returned.
82
84 slurm_free_job_step_info_response_msg Release the storage generated by
85 the slurm_get_job_steps function.
86
87 slurm_get_job_steps Loads into details about job steps that satisfy the
88 job_id and/or step_id specifications provided if the data has been
89 updated since the update_time specified.
90
91 slurm_print_job_step_info Prints the contents of the data structure
92 describing a single job step records from the data loaded by the
93 lurm_get_job_steps function.
94
95 slurm_print_job_step_info_msg Prints the contents of the data structure
96 describing all job step records loaded by the lurm_get_job_steps func‐
97 tion.
98
100 On success, zero is returned. On error, -1 is returned, and Slurm error
101 code is set appropriately.
102
104 SLURM_NO_CHANGE_IN_DATA Data has not changed since update_time.
105
106 SLURM_PROTOCOL_VERSION_ERROR Protocol version has changed, re-link your
107 code.
108
109 SLURM_PROTOCOL_SOCKET_IMPL_TIMEOUT Timeout in communicating with Slurm
110 controller.
111
113 #include <stdio.h>
114 #include <stdlib.h>
115 #include <slurm/slurm.h>
116 #include <slurm/slurm_errno.h>
117
118 int main (int argc, char *argv[])
119 {
120 int i;
121 job_step_info_response_msg_t * step_info_ptr = NULL;
122 job_step_info_t * step_ptr;
123
124 /* get and dump some job information */
125 if ( slurm_get_job_steps ((time_t) NULL, 0, 0,
126 &step_info_ptr, SHOW_ALL) ) {
127 slurm_perror ("slurm_get_job_steps error");
128 exit (1);
129 }
130
131 /* The easy way to print... */
132 slurm_print_job_step_info_msg (stdout,
133 step_info_ptr, 0);
134
135 /* A harder way.. */
136 for (i = 0; i < step_info_ptr->job_step_count; i++) {
137 step_ptr = &step_info_ptr->job_steps[i];
138 slurm_print_job_step_info(stdout, step_ptr, 0);
139 }
140
141 /* The hardest way. */
142 printf ("Steps updated at %lx, record count %d\n",
143 step_info_ptr->last_update,
144 step_info_ptr->job_step_count);
145 for (i = 0; i < step_info_ptr->job_step_count; i++) {
146 printf ("JobId=%u StepId=%u\n",
147 step_info_ptr->job_steps[i].job_id,
148 step_info_ptr->job_steps[i].step_id);
149 }
150
151 slurm_free_job_step_info_response_msg(step_info_ptr);
152 exit (0);
153 }
154
155
157 These functions are included in the libslurm library, which must be
158 linked to your process for use (e.g. "cc -lslurm myprog.c").
159
160 Some data structures contain index values to cross-reference each
161 other. If the show_flags argument is not set to SHOW_ALL when getting
162 this data, these index values will be invalid.
163
164 The slurm_hostlist_ functions can be used to convert Slurm node list
165 expressions into a collection of individual node names.
166
167
169 Copyright (C) 2002-2006 The Regents of the University of California.
170 Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
171 CODE-OCEC-09-009. All rights reserved.
172
173 This file is part of Slurm, a resource management program. For
174 details, see <https://slurm.schedmd.com/>.
175
176 Slurm is free software; you can redistribute it and/or modify it under
177 the terms of the GNU General Public License as published by the Free
178 Software Foundation; either version 2 of the License, or (at your
179 option) any later version.
180
181 Slurm is distributed in the hope that it will be useful, but WITHOUT
182 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
183 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
184 for more details.
185
186
188 scontrol(1), squeue(1), slurm_hostlist_create(3),
189 slurm_hostlist_shift(3), slurm_hostlist_destroy(3), slurm_get_errno(3),
190 slurm_load_jobs(3), slurm_perror(3), slurm_strerror(3)
191
192
193
194
195April 2015 Slurm job step information functions Slurm API(3)