.TH "Slurm API" "3" "Slurm node informational functions" "May 2017" "Slurm node informational functions" .SH "NAME" slurm_free_node_info_msg, slurm_load_node, slurm_load_node_single, slurm_print_node_info_msg, slurm_print_node_table, slurm_sprint_node_table \- Slurm node information reporting functions .SH "SYNTAX" .LP #include .br #include .LP void \fBslurm_free_node_info_msg\fR ( .br node_info_msg_t *\fInode_info_msg_ptr\fP .br ); .LP int \fBslurm_load_node\fR ( .br time_t \fIupdate_time\fP, .br node_info_msg_t **\fInode_info_msg_pptr\fP, .br uint16_t \fIshow_flags\fP .br ); .LP int \fBslurm_load_node_single\fR ( .br node_info_msg_t **\fInode_info_msg_pptr\fP, .br char *\fInode_name\fP, .br uint16_t \fIshow_flags\fP .br ); .LP void \fBslurm_print_node_info_msg\fR ( .br FILE *\fIout_file\fp, .br node_info_msg_t *\fInode_info_msg_ptr\fP, .br int \fIone_liner\fP .br ); .LP void \fBslurm_print_node_table\fR ( .br FILE *\fIout_file\fp, .br node_info_t *\fInode_ptr\fP, .br int \fIone_liner\fP .br ); .LP char *\fBslurm_sprint_node_table\fR ( .br node_info_t *\fInode_ptr\fP, .br int \fIone_liner\fP .br ); .SH "ARGUMENTS" .LP .TP \fInode_info_msg_ptr\fP Specifies the pointer to the structure created by \fBslurm_load_node\fR. .TP \fInode_info_msg_pptr\fP Specifies the double pointer to the structure to be created and filled with the time of the last node update, a record count, and detailed information about each node. Detailed node information is written to fixed sized records and includes: name, state, processor count, memory size, etc. See slurm.h for full details on the data structure's contents. .TP \fInode_name\fP Name of the node for which information is requested. .TP \fInode_ptr\fP Specifies a pointer to a single node record from the \fInode_info_msg_ptr\fP data structure. .TP \fIone_liner\fP Print one record per line if non\-zero. .TP \fIout_file\fP Specifies the file to print data to. .TP \fIshow_flags\fP Job filtering flags, may be ORed. Information about nodes in partitions that are configured as hidden and partitions that the user's group is unable to utilize are not reported by default. The \fBSHOW_ALL\fP flag will cause information about nodes in all partitions to be displayed. Only information about nodes on the local cluster will be returned unless the cluster is in a federation and the \fBSHOW_ALL\fP flag is set. .TP \fIupdate_time\fP 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. .SH "DESCRIPTION" .LP \fBslurm_free_node_info_msg\fR Release the storage generated by the \fBslurm_load_node\fR function. .LP \fBslurm_load_node_single\fR issue RPC to get slurm configuration information for a specific node. .LP \fBslurm_load_node\fR Returns a \fInode_info_msg_t\fP that contains an update time, record count, and array of node_table records for all nodes. Note that nodes which are hidden for any reason will have a NULL node name. Other fields associated with the node will be filled in appropriately. Reasons for a node being hidden include: a node state of FUTURE, a node in the CLOUD that is powered down, or a node in a hidden partition. .LP \fBslurm_print_node_info_msg\fR Prints the contents of the data structure describing all node records from the data loaded by the \fBslurm_load_node\fR function. .LP \fBslurm_print_node_table\fR Prints the contents of the data structure describing a single node record loaded by the \fBslurm_load_node\fR function. .SH "RETURN VALUE" .LP On success, zero is returned. On error, \-1 is returned, and Slurm error code is set appropriately. .SH "ERRORS" .LP \fBSLURM_NO_CHANGE_IN_DATA\fR Data has not changed since \fBupdate_time\fR. .LP \fBSLURM_PROTOCOL_VERSION_ERROR\fR Protocol version has changed, re\-link your code. .LP \fBSLURM_PROTOCOL_SOCKET_IMPL_TIMEOUT\fR Timeout in communicating with Slurm controller. .SH "EXAMPLE" .LP #include .br #include .br #include .br #include .LP int main (int argc, char *argv[]) .br { .br int i, j, k; .br partition_info_msg_t *part_buffer_ptr = NULL; .br partition_info_t *part_ptr; .br node_info_msg_t *node_buffer_ptr = NULL; .br node_info_t *node_ptr; .LP /* get and dump some node information */ .br if ( slurm_load_node ((time_t) NULL, .br &node_buffer_ptr, SHOW_ALL) ) { .br slurm_perror ("slurm_load_node error"); .br exit (1); .br } .LP /* The easy way to print... */ .br slurm_print_node_info_msg (stdout, node_buffer_ptr, 0); .LP /* A harder way.. */ .br for (i = 0; i < node_buffer_ptr\->record_count; i++) { .br node_ptr = &node_buffer_ptr\->node_array[i]; .br slurm_print_node_table(stdout, node_ptr, 0, 0); .br } .LP /* The hardest way. */ .br for (i = 0; i < node_buffer_ptr\->record_count; i++) { .br printf ("NodeName=%s CPUs=%u\\n", .br node_buffer_ptr\->node_array[i].name, .br node_buffer_ptr\->node_array[i].cpus); .br } .LP /* get and dump some partition information */ .br /* note that we use the node information loaded */ .br /* above and we assume the node table entries have */ .br /* not changed since */ .br if ( slurm_load_partitions ((time_t) NULL, .br &part_buffer_ptr, 0) ) { .br slurm_perror ("slurm_load_partitions error"); .br exit (1); .br } .br for (i = 0; i < part_buffer_ptr\->record_count; i++) { .br part_ptr = &part_buffer_ptr\->partition_array[i]; .br printf ("PartitionName=%s Nodes=", .br part_ptr\->name); .br for (j = 0; part_ptr\->node_inx; j+=2) { .br if (part_ptr\->node_inx[j] == \-1) .br break; .br for (k = part_ptr\->node_inx[j]; .br k <= part_ptr\->node_inx[j+1]; .br k++) { .br printf ("%s ", node_buffer_ptr\-> .br node_array[k].name); .br } .br } .br printf("\\n\\n"); .br } .br slurm_free_node_info_msg (node_buffer_ptr); .br slurm_free_partition_info_msg (part_buffer_ptr); .br exit (0); .br } .SH "NOTES" These functions are included in the libslurm library, which must be linked to your process for use (e.g. "cc \-lslurm myprog.c"). .LP Some data structures contain index values to cross\-reference each other. If the \fIshow_flags\fP argument is not set to SHOW_ALL when getting this data, these index values will be invalid. .SH "COPYING" Copyright (C) 2002\-2006 The Regents of the University of California. Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). CODE\-OCEC\-09\-009. All rights reserved. .LP This file is part of Slurm, a resource management program. For details, see . .LP 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. .LP 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. .SH "SEE ALSO" .LP \fBscontrol\fR(1), \fBsqueue\fR(1), \fBslurm_allocation_lookup\fR(3), \fBslurm_get_errno\fR(3), \fBslurm_load_partitions\fR(3), \fBslurm_perror\fR(3), \fBslurm_strerror\fR(3)