Slurm API(3)

NAME
slurm_delete_partition, slurm_init_part_desc_msg, slurm_reconfigure, slurm_shutdown, slurm_update_job, slurm_update_node, slurm_update_partition - Slurm administrative functions

SYNTAX

#include <slurm/slurm.h>

void slurm_init_part_desc_msg (
    update_part_msg_t *update_part_msg_ptr
);

int slurm_reconfigure ( );

int slurm_shutdown (
    uint16_t core
);

int slurm_update_job (
    job_desc_msg_t *update_job_msg_ptr
);

int slurm_update_node (
    update_node_msg_t *update_node_msg_ptr
);

int slurm_delete_partition (
    delete_part_msg_t *delete_part_msg_ptr
);

int slurm_update_partition (
    update_part_msg_t *update_part_msg_ptr
);

ARGUMENTS

core
    Generate a core file if value is non-zero.

delete_part_msg_ptr
    Specifies the pointer to a partition delete request specification. See slurm.h for full details on the data structure's contents.

update_job_msg_ptr
    Specifies the pointer to a job update request specification. See slurm.h for full details on the data structure's contents.

update_node_msg_ptr
    Specifies the pointer to a node update request specification. See slurm.h for full details on the data structure's contents.

update_part_msg_ptr
    Specifies the pointer to a partition update request specification. See slurm.h for full details on the data structure's contents.

DESCRIPTION

slurm_delete_partition Request that the specified partition be deleted. All jobs associated with the identified partition will be terminated and purged. This function may only be successfully executed by user root.

slurm_init_part_desc_msg Initialize the contents of a partition descriptor with default values. Note: slurm_init_part_desc_msg is not equivalent to setting the data structure values to zero. Execute this function before executing slurm_update_part.

slurm_reconfigure Request that the Slurm controller re-read its configuration file. The new configuration parameters take effect immediately. This function may only be successfully executed by user root.

slurm_shutdown Request that the Slurm controller terminate. This function may only be successfully executed by user root.

slurm_update_job Request that the configuration of a job be updated. Note that most, but not all parameters of a job may be changed by this function. Initialize the data structure using the slurm_init_job_desc_msg function prior to setting values of the parameters to be changed. Note: slurm_init_job_desc_msg is not equivalent to setting the data structure values to zero. This function may only be successfully executed by user root. Note the job priority of zero represents a job that will not be scheduled. Slurm uses the priority one to represent jobs that can not be scheduled until additional nodes are returned to service (i.e. not DOWN, DRAINED, or FAILED). This permits lower priority jobs to utilize those resources which are available.

slurm_update_node Request that the state of one or more nodes be updated. Note that the state of a node (e.g. DRAINING, IDLE, etc.) may be changed, but its hardware configuration may not be changed by this function. If the hardware configuration of a node changes, update the Slurm configuration file and execute the slurm_reconfigure function. This function may only be successfully executed by user root. If used by some autonomous program, the state value most likely to be used is NODE_STATE_DRAIN or NODE_STATE_FAILING. The node state flag NODE_STATE_NO_RESPOND may be specified without changing the underlying node state. Note that the node's NODE_STATE_NO_RESPOND flag will be cleared as soon as the slurmd daemon on that node communicates with the slurmctld daemon. Likewise the state NODE_STATE_DOWN indicates that the slurmd daemon is not responding (and has not responded for an interval at least as long as the SlurmdTimeout configuration parameter). The node will leave the NODE_STATE_DOWN state as soon as the slurmd daemon communicates.

slurm_update_partition Request that the configuration of a partition be updated. Note that most, but not all parameters of a partition may be changed by this function. Initialize the data structure using the slurm_init_part_desc_msg function prior to setting values of the parameters to be changed. Note: slurm_init_part_desc_msg is not equivalent to setting the data structure values to zero. If the partition name specified by this function does not already exist, a new partition is created with the supplied parameters. This function may only be successfully executed by user root.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and the Slurm error code is set appropriately.

ERRORS

SLURM_PROTOCOL_VERSION_ERROR Protocol version has changed, re-link your code.

ESLURM_INVALID_NODE_NAME The requested node name(s) is/are not valid.

ESLURM_INVALID_NODE_STATE The specified state node state or requested node state transition is not valid.

ESLURM_INVALID_PARTITION_NAME The requested partition name is not valid.

ESLURM_INVALID_AUTHTYPE_CHANGE The AuthType parameter can not be changed using the slurm_reconfigure function, but all SLURM daemons and commands must be restarted. See slurm.conf(5) for more information.

ESLURM_INVALID_SCHEDTYPE_CHANGE The SchedulerType parameter can not be changed using the slurm_reconfigure function, but the slurmctld daemon must be restarted. Manual changes to existing job parameters may also be required. See slurm.conf(5) for more information.

ESLURM_INVALID_SWITCHTYPE_CHANGE The SwitchType parameter can not be changed using the slurm_reconfigure function, but all SLURM daemons and commands must be restarted. All previously running jobs will be lost. See slurm.conf(5) for more information.

ESLURM_ACCESS_DENIED The requesting user lacks authorization for the requested action (e.g. trying to delete or modify another user's job).

SLURM_PROTOCOL_SOCKET_IMPL_TIMEOUT Timeout in communicating with SLURM controller.

EXAMPLE

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

int main (int argc, char *argv[])
{
    job_desc_msg_t update_job_msg;
    update_node_msg_t update_node_msg;
    partition_desc_msg_t update_part_msg ;
    delete_part_msg_t delete_part_msg ;

    if (slurm_reconfigure ( )) {
        slurm_perror ("slurm_reconfigure error");
        exit (1);
    }

    slurm_init_job_desc_msg( &update_job_msg );
    update_job_msg.job_id = 1234;
    update_job_msg time_limit = 200;
    if (slurm_update_job (&update_job_msg)) {
        slurm_perror ("slurm_update_job error");
        exit (1);
    }

    slurm_init_part_desc_msg ( &update_part_msg );
    update_part_msg.name = "test.partition";
    update_part_msg.state_up = 0; /* partition down */
    if (slurm_update_partition (&update_part_msg)) {
        slurm_perror ("slurm_update_partition error");
        exit (1);
    }

    delete_part_msg.name = "test.partition";
    if (slurm_delete_partition (&delete_part_msg)) {
        slurm_perror ("slurm_delete_partition error");
        exit (1);
    }

    update_node_msg.node_names = "lx[10-12]";
    update_node_msg.node_state = NODE_STATE_DRAINING ;
    if (slurm_update_node (&update_node_msg)) {
        slurm_perror ("slurm_update_node error");
        exit (1);
    }
    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). UCRL-CODE-226842.

This file is part of SLURM, a resource management program. For details, see <http://www.llnl.gov/linux/slurm/>.

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_init_job_desc_msg(3), slurm_perror(3), slurm_strerror(3), slurm.conf(5)