| .TH "Slurm API" "3" "January 2009" "David Bremer" "Slurm reservation information reporting functions" |
| .SH "NAME" |
| slurm_load_reservations, slurm_free_reservation_info_msg, |
| slurm_print_reservation_info, slurm_sprint_reservation_info, |
| slurm_print_reservation_info_msg |
| \- Slurm reservation information reporting functions |
| .SH "SYNTAX" |
| .LP |
| #include <stdio.h> |
| .br |
| #include <slurm/slurm.h> |
| .LP |
| int \fBslurm_load_reservations\fR ( |
| .br |
| time_t \fIupdate_time\fR, |
| .br |
| reserve_info_msg_t **\fIreservation_info_msg_pptr\fP |
| .br |
| ); |
| .LP |
| void \fBslurm_free_reservation_info_msg\fR ( |
| .br |
| reserve_info_msg_t *\fIreservation_info_msg_ptr\fP |
| .br |
| ); |
| .LP |
| void \fBslurm_print_reservation_info\fR ( |
| .br |
| FILE *\fIout_file\fP, |
| .br |
| reserve_info_t *\fIreservation_ptr\fP, |
| .br |
| int \fIone_liner\fP |
| .br |
| ); |
| .LP |
| char * \fBslurm_sprint_reservation_info\fR ( |
| .br |
| reserve_info_t *\fIreservation_ptr\fP, |
| .br |
| int \fIone_liner\fP |
| .br |
| ); |
| .LP |
| void \fBslurm_print_reservation_info_msg\fR ( |
| .br |
| FILE *\fIout_file\fP, |
| .br |
| reserve_info_msg_t *\fIreservation_info_msg_ptr\fP, |
| .br |
| int \fIone_liner\fP |
| .br |
| ); |
| .SH "ARGUMENTS" |
| .LP |
| .TP |
| \fIone_liner\fP |
| Print one record per line if non\-zero. |
| .TP |
| \fIout_file\fP |
| Specifies the file to print data to. |
| .TP |
| \fIreservation_info_msg_pptr\fP |
| Specifies the double pointer to the structure to be created and filled |
| with the time of the last reservation update, a record count, and detailed |
| information about each reservation. Detailed reservation information is |
| written to fixed sized records and includes: reservation name, time limits, |
| access restrictions, etc. See slurm.h for full details on the data |
| structure's contents. |
| .TP |
| \fIreservation_info_msg_ptr\fP |
| Specifies the pointer to the structure created by \fBslurm_load_reservations\fP. |
| .TP |
| \fIupdate_time\fP |
| For all of the following informational calls, if update_time is equal to or greater |
| than the last time changes where made to that information, new information is |
| not returned. Otherwise all the configuration. job, node, or reservation records |
| are returned. |
| .SH "DESCRIPTION" |
| .LP |
| \fBslurm_load_reservations\fR Returns a reserve_info_msg_t that contains an |
| update time, record count, and array of reservation_table records for all reservations. |
| .LP |
| \fBslurm_free_reservation_info_msg\fR Release the storage generated by the |
| \fBslurm_load_reservations\fR function. |
| .LP |
| \fBslurm_print_reservation_info\fR Prints the contents of the data structure |
| describing one of the reservation records from the data loaded by the |
| \fBslurm_load_reservations\fR function. |
| .LP |
| \fBslurm_sprint_reservation_info\fR Prints the sames info as |
| \fBslurm_print_reservation_info\fR, but prints to a string that must be freed |
| by the caller, rather than printing to a file. |
| .LP |
| \fBslurm_print_reservation_info_msg\fR Prints the contents of the data |
| structure describing all reservation records loaded by the |
| \fBslurm_load_reservations\fR function. |
| .SH "RETURN VALUE" |
| .LP |
| On success, zero is returned. On error, \-1 is returned, and Slurm error code |
| is set appropriately. |
| .SH "ERRORS" |
| .LP |
| \fBSLURM_NO_CHANGE_IN_DATA\fR Data has not changed since \fBupdate_time\fR. |
| .LP |
| \fBSLURM_PROTOCOL_VERSION_ERROR\fR Protocol version has changed, re\-link |
| your code. |
| .LP |
| \fBSLURM_PROTOCOL_SOCKET_IMPL_TIMEOUT\fR Timeout in communicating with |
| SLURM controller. |
| .SH "EXAMPLE" |
| .LP |
| #include <stdio.h> |
| .br |
| #include <stdlib.h> |
| .br |
| #include <slurm/slurm.h> |
| .br |
| #include <slurm/slurm_errno.h> |
| .LP |
| int main (int argc, char *argv[]) |
| .br |
| { |
| .br |
| int i; |
| .br |
| reserve_info_msg_t *res_info_ptr = NULL; |
| .br |
| reserve_info_t *res_ptr; |
| .LP |
| /* get and dump all reservation information */ |
| .br |
| if (slurm_load_reservations((time_t)NULL, |
| .br |
| &res_info_ptr)) { |
| .br |
| slurm_perror ("slurm_load_reservations error"); |
| .br |
| exit (1); |
| .br |
| } |
| .LP |
| /* The easy way to print... */ |
| .br |
| slurm_print_reservation_info_msg(stdout, |
| .br |
| res_info_ptr, 0); |
| .LP |
| /* A harder way.. */ |
| .br |
| for (i = 0; i < res_info_ptr\->record_count; i++) { |
| .br |
| res_ptr = &res_info_ptr\->reservation_array[i]; |
| .br |
| slurm_print_reservation_info(stdout, res_ptr, 0); |
| .br |
| } |
| .LP |
| /* The hardest way. */ |
| .br |
| printf("reservations updated at %lx, records=%d\\n", |
| .br |
| res_info_ptr\->last_update, |
| .br |
| res_info_ptr\->record_count); |
| .br |
| for (i = 0; i < res_info_ptr\->record_count; i++) { |
| .br |
| printf ("reservationName=%s Nodes=%s\\n", |
| .br |
| res_info_ptr\->reservation_array[i].name, |
| .br |
| res_info_ptr\->reservation_array[i].node_list ); |
| .br |
| } |
| .LP |
| slurm_free_reservation_info_msg (res_info_ptr); |
| .br |
| return 0; |
| .br |
| } |
| |
| .SH "NOTES" |
| These functions are included in the libslurm library, |
| which must be linked to your process for use |
| (e.g. "cc \-lslurm myprog.c"). |
| .LP |
| The \fBslurm_hostlist_\fR functions can be used to convert SLURM node list |
| expressions into a collection of individual node names. |
| |
| .SH "COPYING" |
| Copyright (C) 2002\-2006 The Regents of the University of California. |
| Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). |
| CODE\-OCEC\-09\-009. All rights reserved. |
| .LP |
| This file is part of SLURM, a resource management program. |
| For details, see <https://computing.llnl.gov/linux/slurm/>. |
| .LP |
| SLURM is free software; you can redistribute it and/or modify it under |
| the terms of the GNU General Public License as published by the Free |
| Software Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| .LP |
| SLURM is distributed in the hope that it will be useful, but WITHOUT ANY |
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| details. |
| |
| .SH "SEE ALSO" |
| .LP |
| \fBscontrol\fR(1), \fBsinfo\fR(1), \fBsqueue\fR(1), |
| \fBslurm_hostlist_create\fR(3), \fBslurm_hostlist_shift\fR(3), |
| \fBslurm_hostlist_destroy\fR(3), |
| \fBslurm_get_errno\fR(3), \fBslurm_load_node\fR(3), |
| \fBslurm_perror\fR(3), \fBslurm_strerror\fR(3) |
| |