Slurm API(3)

NAME
slurm_free_ctl_conf, slurm_load_ctl_conf, slurm_print_ctl_conf - Slurm information reporting functions

SYNTAX

#include <stdio.h>
#include <slurm/slurm.h>

long slurm_api_version ();

void slurm_free_ctl_conf (
    slurm_ctl_conf_t *conf_info_msg_ptr
);

int slurm_load_ctl_conf (
    time_t update_time,
    slurm_ctl_conf_t **conf_info_msg_pptr
);

void slurm_print_ctl_conf (
    FILE *out_file,
    slurm_ctl_conf_t *conf_info_msg_ptr
);

ARGUMENTS

conf_info_msg_pptr
    Specifies the double pointer to the structure to be created and filled with the time of the last configuration update and detailed configuration information. Configuration information includes control machine names, file names, timer values, etc. See slurm.h for full details on the data structure's contents.

conf_info_msg_ptr
    Specifies the pointer to the structure created by slurm_load_ctl_conf.

out_file
    Specifies the file to print data to.

update_time
    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 partition records are returned.

DESCRIPTION

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_ctl_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.

RETURN VALUE

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.

ERRORS

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.

EXAMPLE

#include <stdio.h>
#include <stdlib.h>
#include <slurm/slurm.h>
#include <slurm/slurm_errno.h>

int main (int argc, char *argv[])
{
    slurm_ctl_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);
}

NOTE
These functions are included in the libslurm library, which must be linked to your process for use (e.g. "cc -lslurm myprog.c").

COPYING
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.

SEE ALSO

scontrol(1), slurm_get_errno(3), slurm_perror(3), slurm_strerror(3)