diff --git a/NEWS b/NEWS index 29b83c6819ecdede31cf79e82b0bb5438b340618..657735b0af6856ad10bbeac11d0f34c5faa5ca1b 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,10 @@ documents those changes that are of interest to users and admins. pthreads (under heavy load this resulted in hundreds of pthreads using more memory than was available). -- Restructure slurmctld message agent for higher throughput. + -- Add new sinfo options --responding and --dead (i.e. non-responding) + for filtering node states. + -- Fix bug in sinfo to properly process specified state filter including + "*" suffix for non-responding nodes. * Changes in SLURM 0.3.0.0-pre7 =============================== diff --git a/doc/man/man1/sinfo.1 b/doc/man/man1/sinfo.1 index 91b5dfc3ba47eb5fccde972f3e75cf679cd54084..1ccd2e907bc3b66a2509f8979264a2581b8a65a8 100644 --- a/doc/man/man1/sinfo.1 +++ b/doc/man/man1/sinfo.1 @@ -1,4 +1,4 @@ -.TH SINFO "1" "February 2004" "sinfo 0.3" "Slurm components" +.TH SINFO "1" "March 2004" "sinfo 0.3" "Slurm components" .SH "NAME" sinfo \- Used to view information about Slurm nodes and partitions. @@ -17,6 +17,9 @@ Print a message describing all \fBsinfo\fR options. \fB\-\-usage\fR Print a brief message listing the \fBsinfo\fR options. .TP +\fB\-d\fR, \fB\-\-dead\fR +If set only report state information for non-responding (dead) nodes. +.TP \fB\-e\fR, \fB\-\-exact\fR If set, do not group node information on multiple nodes unless their configurations to be reported are identical. Otherwise cpu count, @@ -109,6 +112,9 @@ the different node states will be placed on separate lines. .br \fB%<Number><*>\fR size of field .TP +\fB\-r\fR, \fB\-\-responding\fR +If set only report state information for responding nodes. +.TP \fB\-s\fR , \fB\-\-summarize\fR List only a partition state summary with no node state details. This is ignored if the \fB\-\-format\fR option is specified. @@ -138,9 +144,11 @@ insensitive. Possible values include: ALLOC, ALLOCATED, COMP, COMPLETING, DOWN, DRAIN, DRAINED, DRAINING, IDLE, UNK, and UNKNOWN. A "*" suffix may be appended to any of these states to search for -nodes in the specified state which are not responding. +nodes in the specified state which are not responding. By default nodes in the specified state are reported whether they are responding or not. +Also note the \fB\-\-dead\fR and \fB\-\-responding\fR options for +filtering nodes by state. .TP \fB\-p <partition>\fR, \fB\-\-partition=<partition>\fR Print information only about the specified partition. diff --git a/src/sinfo/opts.c b/src/sinfo/opts.c index 52f111795a95793a640cd901bdeacab8d7b86302..4562e89e1270cdd2312692b2e3506f73d65e1513 100644 --- a/src/sinfo/opts.c +++ b/src/sinfo/opts.c @@ -71,6 +71,7 @@ extern void parse_command_line(int argc, char *argv[]) int opt_char; int option_index; static struct option long_options[] = { + {"dead", no_argument, 0, 'd'}, {"exact", no_argument, 0, 'e'}, {"noheader", no_argument, 0, 'h'}, {"iterate", required_argument, 0, 'i'}, @@ -79,6 +80,7 @@ extern void parse_command_line(int argc, char *argv[]) {"Node", no_argument, 0, 'N'}, {"format", required_argument, 0, 'o'}, {"partition", required_argument, 0, 'p'}, + {"responding",no_argument, 0, 'r'}, {"summarize", no_argument, 0, 's'}, {"sort", required_argument, 0, 'S'}, {"states", required_argument, 0, 't'}, @@ -88,13 +90,16 @@ extern void parse_command_line(int argc, char *argv[]) {"usage", no_argument, 0, OPT_LONG_USAGE} }; - while((opt_char = getopt_long(argc, argv, "ehi:ln:No:p:sS:t:vV", + while((opt_char = getopt_long(argc, argv, "dehi:ln:No:p:rsS:t:vV", long_options, &option_index)) != -1) { switch (opt_char) { case (int)'?': fprintf(stderr, "Try \"sinfo --help\" for more information\n"); exit(1); break; + case (int)'d': + params.dead_nodes = true; + break; case (int)'e': params.exact_match = true; break; @@ -125,6 +130,9 @@ extern void parse_command_line(int argc, char *argv[]) case (int) 'p': params.partition = xstrdup(optarg); break; + case (int) 'r': + params.responding_nodes = true; + break; case (int) 's': params.summarize = true; break; @@ -184,7 +192,8 @@ extern void parse_command_line(int argc, char *argv[]) } _parse_format( params.format ); - if (params.nodes || params.partition || params.state_list) + if (params.dead_nodes || params.nodes || params.partition || + params.responding_nodes ||params.state_list) params.filtering = true; if (params.verbose) @@ -252,16 +261,24 @@ _build_all_states_list( void ) static int _parse_state( char* str, uint16_t* states ) { - int i; + int i, len; + uint16_t no_resp; char *state_names; + len = strlen(str); + if (str[len - 1] == '*') { + no_resp = NODE_STATE_NO_RESPOND; + len--; + } else + no_resp = 0; + for (i = 0; i<NODE_STATE_END; i++) { - if (strcasecmp (node_state_string(i), str) == 0) { - *states = i; + if (strncasecmp (node_state_string(i), str, len) == 0) { + *states = (i | no_resp); return SLURM_SUCCESS; } - if (strcasecmp (node_state_string_compact(i), str) == 0) { - *states = i; + if (strncasecmp (node_state_string_compact(i), str, len) == 0) { + *states = (i | no_resp); return SLURM_SUCCESS; } } @@ -482,6 +499,7 @@ _parse_token( char *token, char *field, int *field_size, bool *right_justify, void _print_options( void ) { printf("-----------------------------\n"); + printf("dead = %s\n", params.dead_nodes ? "true" : "false"); printf("exact = %d\n", params.exact_match); printf("filtering = %s\n", params.filtering ? "true" : "false"); printf("format = %s\n", params.format); @@ -494,6 +512,8 @@ void _print_options( void ) printf("nodes = %s\n", params.nodes ? params.nodes : "n/a"); printf("partition = %s\n", params.partition ? params.partition: "n/a"); + printf("responding = %s\n", params.responding_nodes ? + "true" : "false"); printf("states = %s\n", params.states); printf("sort = %s\n", params.sort); printf("summarize = %s\n", params.summarize ? "true" : "false"); @@ -539,12 +559,13 @@ static void _print_version(void) static void _usage( void ) { printf("Usage: sinfo [-i seconds] [-t node_state] [-p PARTITION] [-n NODES]\n"); - printf(" [-S fields] [-o format] [--usage] [-elNsv]\n"); + printf(" [-S fields] [-o format] [--usage] [-delNrsv]\n"); } static void _help( void ) { printf("Usage: sinfo [OPTIONS]\n"); + printf(" -d, --dead show only non-responding nodes\n"); printf(" -e, --exact group nodes only on exact match of\n"); printf(" configuration\n"); printf(" -h, --noheader no headers on output\n"); @@ -554,6 +575,7 @@ static void _help( void ) printf(" -N, --Node Node-centric format\n"); printf(" -o, --format=format format specification\n"); printf(" -p, --partition=PARTITION report on specific partition\n"); + printf(" -r, --responding report only responding nodes\n"); printf(" -s, --summarize report state summary only\n"); printf(" -S, --sort=fields comma seperated list of fields to sort on\n"); printf(" -t, --states=node_state specify the what states of nodes to view\n"); diff --git a/src/sinfo/sinfo.c b/src/sinfo/sinfo.c index 58238027e8ac74c922aa3f93e867c0c6b52b22a7..faed315159e65082e4d1243d1f8ff62f96911119 100644 --- a/src/sinfo/sinfo.c +++ b/src/sinfo/sinfo.c @@ -233,6 +233,14 @@ static bool _filter_out(node_info_t *node_ptr) return true; } + if ( (params.dead_nodes) && + (!(node_ptr->node_state & NODE_STATE_NO_RESPOND)) ) + return true; + + if ( (params.responding_nodes) && + (node_ptr->node_state & NODE_STATE_NO_RESPOND) ) + return true; + if (params.state_list) { int *node_state; bool match = false; diff --git a/src/sinfo/sinfo.h b/src/sinfo/sinfo.h index 61e5813889330aa936ff6ae3a08d64306a274876..1ec69ebf65b5a2d3c0238f0bff56d0ec04d96a93 100644 --- a/src/sinfo/sinfo.h +++ b/src/sinfo/sinfo.h @@ -104,12 +104,14 @@ struct sinfo_match_flags { /* Input parameters */ struct sinfo_parameters { + bool dead_nodes; bool exact_match; bool filtering; bool long_output; bool no_header; bool node_field_flag; bool node_flag; + bool responding_nodes; bool summarize; struct sinfo_match_flags match_flags;