1Slurm API(3)        Slurm reservation information functions       Slurm API(3)
2
3
4

NAME

6       slurm_load_reservations,               slurm_free_reservation_info_msg,
7       slurm_print_reservation_info,            slurm_sprint_reservation_info,
8       slurm_print_reservation_info_msg   -   Slurm   reservation  information
9       reporting functions
10

SYNTAX

12       #include <stdio.h>
13       #include <slurm/slurm.h>
14
15       int slurm_load_reservations (
16            time_t update_time,
17            reserve_info_msg_t **reservation_info_msg_pptr
18        );
19
20       void slurm_free_reservation_info_msg (
21            reserve_info_msg_t *reservation_info_msg_ptr
22       );
23
24       void slurm_print_reservation_info (
25            FILE *out_file,
26            reserve_info_t *reservation_ptr,
27            int one_liner
28       );
29
30       char * slurm_sprint_reservation_info (
31            reserve_info_t *reservation_ptr,
32            int one_liner
33       );
34
35       void slurm_print_reservation_info_msg (
36            FILE *out_file,
37            reserve_info_msg_t *reservation_info_msg_ptr,
38            int one_liner
39       );
40

ARGUMENTS

42       one_liner
43              Print one record per line if non-zero.
44
45       out_file
46              Specifies the file to print data to.
47
48       reservation_info_msg_pptr
49              Specifies the double pointer to the structure to be created  and
50              filled  with  the  time of the last reservation update, a record
51              count,  and  detailed  information   about   each   reservation.
52              Detailed  reservation  information  is  written  to  fixed sized
53              records and includes:  reservation  name,  time  limits,  access
54              restrictions,  etc.   See  slurm.h  for full details on the data
55              structure's contents.
56
57       reservation_info_msg_ptr
58              Specifies   the   pointer   to   the   structure   created    by
59              slurm_load_reservations.
60
61       update_time
62              For  all of the following informational calls, if update_time is
63              equal to or greater than the last time  changes  where  made  to
64              that  information,  new  information is not returned.  Otherwise
65              all the configuration. job, node,  or  reservation  records  are
66              returned.
67

DESCRIPTION

69       slurm_load_reservations  Returns  a reserve_info_msg_t that contains an
70       update time, record count, and array of reservation_table  records  for
71       all reservations.
72
73       slurm_free_reservation_info_msg  Release  the  storage generated by the
74       slurm_load_reservations function.
75
76       slurm_print_reservation_info  Prints the contents of the data structure
77       describing  one  of the reservation records from the data loaded by the
78       slurm_load_reservations function.
79
80       slurm_sprint_reservation_info     Prints    the    sames    info     as
81       slurm_print_reservation_info, but prints to a string that must be freed
82       by the caller, rather than printing to a file.
83
84       slurm_print_reservation_info_msg Prints the contents of the data struc‐
85       ture describing all reservation records loaded by the slurm_load_reser‐
86       vations function.
87

RETURN VALUE

89       On success, zero is returned. On error, -1 is returned, and Slurm error
90       code is set appropriately.
91

ERRORS

93       SLURM_NO_CHANGE_IN_DATA Data has not changed since update_time.
94
95       SLURM_PROTOCOL_VERSION_ERROR Protocol version has changed, re-link your
96       code.
97
98       SLURM_PROTOCOL_SOCKET_IMPL_TIMEOUT Timeout in communicating with  Slurm
99       controller.
100

EXAMPLE

102       #include <stdio.h>
103       #include <stdlib.h>
104       #include <slurm/slurm.h>
105       #include <slurm/slurm_errno.h>
106
107       int main (int argc, char *argv[])
108       {
109            int i;
110            reserve_info_msg_t *res_info_ptr = NULL;
111            reserve_info_t *res_ptr;
112
113            /* get and dump all reservation information */
114            if (slurm_load_reservations((time_t)NULL,
115                                        &res_info_ptr)) {
116                 slurm_perror ("slurm_load_reservations error");
117                 exit (1);
118            }
119
120            /* The easy way to print... */
121            slurm_print_reservation_info_msg(stdout,
122                                             res_info_ptr, 0);
123
124            /* A harder way.. */
125            for (i = 0; i < res_info_ptr->record_count; i++) {
126                 res_ptr = &res_info_ptr->reservation_array[i];
127                 slurm_print_reservation_info(stdout, res_ptr, 0);
128            }
129
130            /* The hardest way. */
131            printf("reservations updated at %lx, records=%d\n",
132                   res_info_ptr->last_update,
133                   res_info_ptr->record_count);
134            for (i = 0; i < res_info_ptr->record_count; i++) {
135                 printf ("reservationName=%s Nodes=%s\n",
136                      res_info_ptr->reservation_array[i].name,
137                      res_info_ptr->reservation_array[i].node_list );
138            }
139
140            slurm_free_reservation_info_msg (res_info_ptr);
141            return 0;
142       }
143
144

NOTES

146       These  functions  are  included  in the libslurm library, which must be
147       linked to your process for use (e.g. "cc -lslurm myprog.c").
148
149       The slurm_hostlist_ functions can be used to convert  Slurm  node  list
150       expressions into a collection of individual node names.
151
152

COPYING

154       Copyright  (C)  2002-2006  The Regents of the University of California.
155       Produced at Lawrence Livermore National  Laboratory  (cf,  DISCLAIMER).
156       CODE-OCEC-09-009. All rights reserved.
157
158       This  file  is  part  of  Slurm,  a  resource  management program.  For
159       details, see <https://slurm.schedmd.com/>.
160
161       Slurm is free software; you can redistribute it and/or modify it  under
162       the  terms  of  the GNU General Public License as published by the Free
163       Software Foundation; either version 2  of  the  License,  or  (at  your
164       option) any later version.
165
166       Slurm  is  distributed  in the hope that it will be useful, but WITHOUT
167       ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY  or
168       FITNESS  FOR  A PARTICULAR PURPOSE.  See the GNU General Public License
169       for more details.
170
171

SEE ALSO

173       scontrol(1),     sinfo(1),     squeue(1),     slurm_hostlist_create(3),
174       slurm_hostlist_shift(3), slurm_hostlist_destroy(3), slurm_get_errno(3),
175       slurm_load_node(3), slurm_perror(3), slurm_strerror(3)
176
177
178
179
180April 2015          Slurm reservation information functions       Slurm API(3)
Impressum