1
.TH "Slurm API" "3" "January 2009" "David Bremer" "Slurm reservation information reporting functions"
3
slurm_load_reservations, slurm_free_reservation_info_msg,
4
slurm_print_reservation_info, slurm_sprint_reservation_info,
5
slurm_print_reservation_info_msg
6
\- Slurm reservation information reporting functions
11
#include <slurm/slurm.h>
13
int \fBslurm_load_reservations\fR (
15
time_t \fIupdate_time\fR,
17
reserve_info_msg_t **\fIreservation_info_msg_pptr\fP
21
void \fBslurm_free_reservation_info_msg\fR (
23
reserve_info_msg_t *\fIreservation_info_msg_ptr\fP
27
void \fBslurm_print_reservation_info\fR (
31
reserve_info_t *\fIreservation_ptr\fP,
37
char * \fBslurm_sprint_reservation_info\fR (
39
reserve_info_t *\fIreservation_ptr\fP,
45
void \fBslurm_print_reservation_info_msg\fR (
49
reserve_info_msg_t *\fIreservation_info_msg_ptr\fP,
58
Print one record per line if non\-zero.
61
Specifies the file to print data to.
63
\fIreservation_info_msg_pptr\fP
64
Specifies the double pointer to the structure to be created and filled
65
with the time of the last reservation update, a record count, and detailed
66
information about each reservation. Detailed reservation information is
67
written to fixed sized records and includes: reservation name, time limits,
68
access restrictions, etc. See slurm.h for full details on the data
71
\fIreservation_info_msg_ptr\fP
72
Specifies the pointer to the structure created by \fBslurm_load_reservations\fP.
75
For all of the following informational calls, if update_time is equal to or greater
76
than the last time changes where made to that information, new information is
77
not returned. Otherwise all the configuration. job, node, or reservation records
81
\fBslurm_load_reservations\fR Returns a reserve_info_msg_t that contains an
82
update time, record count, and array of reservation_table records for all reservations.
84
\fBslurm_free_reservation_info_msg\fR Release the storage generated by the
85
\fBslurm_load_reservations\fR function.
87
\fBslurm_print_reservation_info\fR Prints the contents of the data structure
88
describing one of the reservation records from the data loaded by the
89
\fBslurm_load_reservations\fR function.
91
\fBslurm_sprint_reservation_info\fR Prints the sames info as
92
\fBslurm_print_reservation_info\fR, but prints to a string that must be freed
93
by the caller, rather than printing to a file.
95
\fBslurm_print_reservation_info_msg\fR Prints the contents of the data
96
structure describing all reservation records loaded by the
97
\fBslurm_load_reservations\fR function.
100
On success, zero is returned. On error, \-1 is returned, and Slurm error code
101
is set appropriately.
104
\fBSLURM_NO_CHANGE_IN_DATA\fR Data has not changed since \fBupdate_time\fR.
106
\fBSLURM_PROTOCOL_VERSION_ERROR\fR Protocol version has changed, re\-link
109
\fBSLURM_PROTOCOL_SOCKET_IMPL_TIMEOUT\fR Timeout in communicating with
117
#include <slurm/slurm.h>
119
#include <slurm/slurm_errno.h>
121
int main (int argc, char *argv[])
127
reserve_info_msg_t *res_info_ptr = NULL;
129
reserve_info_t *res_ptr;
131
/* get and dump all reservation information */
133
if (slurm_load_reservations((time_t)NULL,
137
slurm_perror ("slurm_load_reservations error");
143
/* The easy way to print... */
145
slurm_print_reservation_info_msg(stdout,
151
for (i = 0; i < res_info_ptr\->record_count; i++) {
153
res_ptr = &res_info_ptr\->reservation_array[i];
155
slurm_print_reservation_info(stdout, res_ptr, 0);
159
/* The hardest way. */
161
printf("reservations updated at %lx, records=%d\\n",
163
res_info_ptr\->last_update,
165
res_info_ptr\->record_count);
167
for (i = 0; i < res_info_ptr\->record_count; i++) {
169
printf ("reservationName=%s Nodes=%s\\n",
171
res_info_ptr\->reservation_array[i].name,
173
res_info_ptr\->reservation_array[i].node_list );
177
slurm_free_reservation_info_msg (res_info_ptr);
184
These functions are included in the libslurm library,
185
which must be linked to your process for use
186
(e.g. "cc \-lslurm myprog.c").
188
The \fBslurm_hostlist_\fR functions can be used to convert SLURM node list
189
expressions into a collection of individual node names.
192
Copyright (C) 2002\-2006 The Regents of the University of California.
193
Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
194
CODE\-OCEC\-09\-009. All rights reserved.
196
This file is part of SLURM, a resource management program.
197
For details, see <https://computing.llnl.gov/linux/slurm/>.
199
SLURM is free software; you can redistribute it and/or modify it under
200
the terms of the GNU General Public License as published by the Free
201
Software Foundation; either version 2 of the License, or (at your option)
204
SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
205
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
206
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
211
\fBscontrol\fR(1), \fBsinfo\fR(1), \fBsqueue\fR(1),
212
\fBslurm_hostlist_create\fR(3), \fBslurm_hostlist_shift\fR(3),
213
\fBslurm_hostlist_destroy\fR(3),
214
\fBslurm_get_errno\fR(3), \fBslurm_load_node\fR(3),
215
\fBslurm_perror\fR(3), \fBslurm_strerror\fR(3)