1Slurm API(3) Slurm front end node informational functions Slurm API(3)
2
3
4
6 slurm_free_front_end_info_msg, slurm_load_front_end,
7 slurm_print_front_end_info_msg, slurm_print_front_end_table,
8 slurm_sprint_front_end_table - Slurm front end node information report‐
9 ing functions
10
11
13 #include <stdio.h>
14 #include <slurm/slurm.h>
15
16 void slurm_free_front_end_info_msg (
17 front_end_info_msg_t *front_end_info_msg_ptr
18 );
19
20 int slurm_load_front_end (
21 time_t update_time,
22 front_end_info_msg_t **front_end_info_msg_pptr,
23 );
24
25 void slurm_print_front_end_info_msg (
26 FILE *out_file,
27 front_end_info_msg_t *front_end_info_msg_ptr,
28 int one_liner
29 );
30
31 void slurm_print_front_end_table (
32 FILE *out_file,
33 front_end_info_t *front_end_ptr,
34 int one_liner
35 );
36
37 char *slurm_sprint_front_end_table (
38 front_end_info_t *front_end_ptr,
39 int one_liner
40 );
41
42
44 front_end_info_msg_ptr
45 Specifies the pointer to the structure created by
46 slurm_load_front_end.
47
48 front_end_info_msg_pptr
49 Specifies the double pointer to the structure to be created and
50 filled with the time of the last front end node update, a record
51 count, and detailed information about each front_end node.
52 Detailed front_end node information is written to fixed sized
53 records and includes: name, state, etc. See slurm.h for full
54 details on the data structure's contents.
55
56 front_end_ptr
57 Specifies a pointer to a single front end node record from the
58 front_end_info_msg_ptr data structure.
59
60 one_liner
61 Print one record per line if non-zero.
62
63 out_file
64 Specifies the file to print data to.
65
66 update_time
67 For all of the following informational calls, if update_time is
68 equal to or greater than the last time changes where made to
69 that information, new information is not returned. Otherwise
70 all the configuration. job, node, or partition records are
71 returned.
72
73
75 slurm_free_front_end_info_msg Release the storage generated by the
76 slurm_load_front_end function.
77
78 slurm_load_front_end Returns a ont_end_info_msg_t that contains an
79 update time, record count, and array of records for all front end
80 nodes.
81
82 slurm_print_front_end_info_msg Prints the contents of the data struc‐
83 ture describing all front end node records from the data loaded by the
84 slurm_load_front_end function.
85
86 slurm_print_front_end_table Prints to a file the contents of the data
87 structure describing a single front end node record loaded by the
88 slurm_load_front_end function.
89
90 slurm_psrint_front_end_table Prints to memory the contents of the data
91 structure describing a single front end node record loaded by the
92 slurm_load_front_end function.
93
94
96 On success, zero is returned. On error, -1 is returned, and Slurm error
97 code is set appropriately.
98
99
101 SLURM_NO_CHANGE_IN_DATA Data has not changed since update_time.
102
103 SLURM_PROTOCOL_VERSION_ERROR Protocol version has changed, re-link your
104 code.
105
106 SLURM_PROTOCOL_SOCKET_IMPL_TIMEOUT Timeout in communicating with Slurm
107 controller.
108
109
111 #include <stdio.h>
112 #include <slurm/slurm.h>
113 #include <slurm/slurm_errno.h>
114
115 int main (int argc, char *argv[])
116 {
117 int i;
118 front_end_info_msg_t *front_end_info_ptr = NULL;
119 front_end_info_t *front_end_ptr;
120
121 /* get and dump some node information */
122 if ( slurm_load_front_end ((time_t) NULL,
123 &front_end_buffer_ptr) ) {
124 slurm_perror ("slurm_load_front_end error");
125 exit (1);
126 }
127
128 /* The easy way to print... */
129 slurm_print_front_end_info_msg (stdout, front_end_buffer_ptr, 0);
130
131 /* A harder way.. */
132 for (i = 0; i < front_end_buffer_ptr->record_count; i++) {
133 front_end_ptr = &front_end_buffer_ptr->front_end_array[i];
134 slurm_print_front_end_table(stdout, front_end_ptr, 0);
135 }
136
137 /* The hardest way. */
138 for (i = 0; i < front_end_buffer_ptr->front_end_count; i++) {
139 printf ("FrontEndName=%s StateCode=%u\n",
140 front_end_buffer_ptr->front_end_array[i].name,
141 front_end_buffer_ptr->front_end_array[i].node_state);
142 }
143 slurm_free_front_end_info_msg (front_end_buffer_ptr);
144 exit (0);
145 }
146
147
149 These functions are included in the libslurm library, which must be
150 linked to your process for use (e.g. "cc -lslurm myprog.c").
151
152 Some data structures contain index values to cross-reference each
153 other. If the show_flags argument is not set to SHOW_ALL when getting
154 this data, these index values will be invalid.
155
156
158 Copyright (C) 2010 Lawrence Livermore National Security. Produced at
159 Lawrence Livermore National Laboratory (cf, DISCLAIMER).
160 CODE-OCEC-09-009. All rights reserved.
161
162 This file is part of Slurm, a resource management program. For
163 details, see <https://slurm.schedmd.com/>.
164
165 Slurm is free software; you can redistribute it and/or modify it under
166 the terms of the GNU General Public License as published by the Free
167 Software Foundation; either version 2 of the License, or (at your
168 option) any later version.
169
170 Slurm is distributed in the hope that it will be useful, but WITHOUT
171 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
172 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
173 for more details.
174
176 scontrol(1), slurm_get_errno(3), slurm_load_node(3), slurm_perror(3),
177 slurm_strerror(3)
178
179
180
181
182April 2015 Slurm front end node informational functions Slurm API(3)