1Slurm API(3) Slurm informational functions Slurm API(3)
2
3
4
6 slurm_free_ctl_conf, slurm_load_ctl_conf, slurm_print_ctl_conf - Slurm
7 information reporting functions
8
9
11 #include <stdio.h>
12 #include <slurm/slurm.h>
13
14 long slurm_api_version ();
15
16 void slurm_free_ctl_conf (
17 slurm_ctl_conf_t *conf_info_msg_ptr
18 );
19
20 int slurm_load_ctl_conf (
21 time_t update_time,
22 slurm_ctl_conf_t **conf_info_msg_pptr
23 );
24
25 void slurm_print_ctl_conf (
26 FILE *out_file,
27 slurm_ctl_conf_t *conf_info_msg_ptr
28 );
29
31 conf_info_msg_pptr
32 Specifies the double pointer to the structure to be created and
33 filled with the time of the last configuration update and
34 detailed configuration information. Configuration information
35 includes control machine names, file names, timer values, etc.
36 See slurm.h for full details on the data structure's contents.
37
38 conf_info_msg_ptr
39 Specifies the pointer to the structure created by
40 slurm_load_ctl_conf.
41
42 out_file
43 Specifies the file to print data to.
44
45 update_time
46 For all of the following informational calls, if update_time is
47 equal to or greater than the last time changes where made to
48 that information, new information is not returned. Otherwise
49 all the configuration. job, node, or partition records are
50 returned.
51
53 slurm_api_version Return the Slurm API version number.
54
55 slurm_free_ctl_conf Release the storage generated by the
56 slurm_load_ctl_conf function.
57
58 slurm_load_ctl_conf Returns a slurm_ctl_conf_t that contains Slurm con‐
59 figuration records.
60
61 slurm_print_ctl_conf Prints the contents of the data structure loaded
62 by the slurm_load_ctl_conf function.
63
65 For slurm_api_version the Slurm API version number is returned. All
66 other functions return zero on success and -1 on error with the Slurm
67 error code set appropriately.
68
70 SLURM_NO_CHANGE_IN_DATA Data has not changed since update_time.
71
72 SLURM_PROTOCOL_VERSION_ERROR Protocol version has changed, re-link your
73 code.
74
75 SLURM_PROTOCOL_SOCKET_IMPL_TIMEOUT Timeout in communicating with Slurm
76 controller.
77
79 #include <stdio.h>
80 #include <stdlib.h>
81 #include <slurm/slurm.h>
82 #include <slurm/slurm_errno.h>
83
84 int main (int argc, char *argv[])
85 {
86 slurm_ctl_conf_t * conf_info_msg_ptr = NULL;
87 long version = slurm_api_version();
88
89 /* We can use the Slurm version number to determine how
90 * API should be used */
91 printf("slurm_api_version: %ld, %ld.%ld.%ld\n", version,
92 SLURM_VERSION_MAJOR(version),
93 SLURM_VERSION_MINOR(version),
94 SLURM_VERSION_MICRO(version));
95
96 /* get and print some configuration information */
97 if ( slurm_load_ctl_conf ((time_t) NULL,
98 &conf_info_msg_ptr ) ) {
99 slurm_perror ("slurm_load_ctl_conf error");
100 exit (1);
101 }
102 /* The easy way to print */
103 slurm_print_ctl_conf (stdout,
104 conf_info_msg_ptr);
105
106 /* The hard way */
107 printf ("control_machine = %s\n",
108 conf_info_msg_ptr->control_machine[0]);
109 printf ("first_job_id = %u\n",
110 conf_info_msg_ptr->first_job_id);
111
112 slurm_free_ctl_conf (conf_info_msg_ptr);
113 exit (0);
114 }
115
116
118 These functions are included in the libslurm library, which must be
119 linked to your process for use (e.g. "cc -lslurm myprog.c").
120
121
123 Copyright (C) 2002-2007 The Regents of the University of California.
124 Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
125 CODE-OCEC-09-009. All rights reserved.
126
127 This file is part of Slurm, a resource management program. For
128 details, see <https://slurm.schedmd.com/>.
129
130 Slurm is free software; you can redistribute it and/or modify it under
131 the terms of the GNU General Public License as published by the Free
132 Software Foundation; either version 2 of the License, or (at your
133 option) any later version.
134
135 Slurm is distributed in the hope that it will be useful, but WITHOUT
136 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
137 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
138 for more details.
139
141 scontrol(1), slurm_get_errno(3), slurm_perror(3), slurm_strerror(3)
142
143
144
145
146September 2019 Slurm informational functions Slurm API(3)