Slurm API(3) | Slurm informational functions | Slurm API(3) |
slurm_free_ctl_conf, slurm_load_ctl_conf, slurm_print_ctl_conf - Slurm information reporting functions
#include <stdio.h>
#include <slurm/slurm.h>
long slurm_api_version ();
void slurm_free_ctl_conf (
slurm_conf_t *conf_info_msg_ptr
);
int slurm_load_ctl_conf (
time_t update_time,
slurm_conf_t **conf_info_msg_pptr
);
void slurm_print_ctl_conf (
FILE *out_file,
slurm_conf_t *conf_info_msg_ptr
);
slurm_api_version Return the Slurm API version number.
slurm_free_ctl_conf Release the storage generated by the slurm_load_ctl_conf function.
slurm_load_ctl_conf Returns a slurm_conf_t that contains Slurm configuration records.
slurm_print_ctl_conf Prints the contents of the data structure loaded by the slurm_load_ctl_conf function.
For slurm_api_version the Slurm API version number is returned. All other functions return zero on success and -1 on error with the Slurm error code set appropriately.
SLURM_NO_CHANGE_IN_DATA Data has not changed since update_time.
SLURM_PROTOCOL_VERSION_ERROR Protocol version has changed, re-link your code.
SLURM_PROTOCOL_SOCKET_IMPL_TIMEOUT Timeout in communicating with Slurm controller.
#include <stdio.h>
#include <stdlib.h>
#include <slurm/slurm.h>
#include <slurm/slurm_errno.h>
int main (int argc, char *argv[])
{
slurm_conf_t *conf_info_msg_ptr = NULL;
long version = slurm_api_version();
/* We can use the Slurm version number to determine how
* API should be used */
printf("slurm_api_version: %ld, %ld.%ld.%ld\n", version,
SLURM_VERSION_MAJOR(version),
SLURM_VERSION_MINOR(version),
SLURM_VERSION_MICRO(version));
/* get and print some configuration information */
if ( slurm_load_ctl_conf ((time_t) NULL,
&conf_info_msg_ptr ) ) {
slurm_perror ("slurm_load_ctl_conf error");
exit (1);
}
/* The easy way to print */
slurm_print_ctl_conf (stdout,
conf_info_msg_ptr);
/* The hard way */
printf ("control_machine = %s\n",
conf_info_msg_ptr->control_machine[0]);
printf ("first_job_id = %u\n",
conf_info_msg_ptr->first_job_id);
slurm_free_ctl_conf (conf_info_msg_ptr);
exit (0);
}
These functions are included in the libslurm library, which must be linked to your process for use (e.g. "cc -lslurm myprog.c").
Copyright (C) 2002-2007 The Regents of the University of California. Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). CODE-OCEC-09-009. All rights reserved.
This file is part of Slurm, a resource management program. For details, see <https://slurm.schedmd.com/>.
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.
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.
scontrol(1), slurm_get_errno(3), slurm_perror(3), slurm_strerror(3)
Slurm informational functions | March 2020 |