diff --git a/doc/man/man1/sinfo.1 b/doc/man/man1/sinfo.1 index 1ccd2e907bc3b66a2509f8979264a2581b8a65a8..416cff57c3bccb93f0cec6fe0f5b369151fc6b8f 100644 --- a/doc/man/man1/sinfo.1 +++ b/doc/man/man1/sinfo.1 @@ -51,66 +51,100 @@ The default is to print information in a partition-oriented format. This is ignored if the \fB\-\-format\fR option is specified. .TP \fB\-o <output_format>\fR, \fB\-\-format=<output_format>\fR -Specify the information to be displayed. -The default format is "%9P %5a %.9l %.5D %6t %N". -If the \fB\-\-summarize\fR option is specified, the default -format is "%9P %5a %.9l %15F %N". -If the \fB\-\-long\fR option is specified, the default format is -"%9P %5a %.9l %.8s %4r %5h %10g %.5D %11T %N". -If the \fB\-\-Node\fR option is specified, the default format is -"%#N %.5D %9P %6t". -If the \fB\-\-Node\fR and \fB\-\-long\fR options are both specified, -the default format is "%#N %.5D %9P %11T %.4c %.6m %.8d %.6w %8f %R". -In the above two formats the value of "#" represents the maximum +Specify the information to be displayed using an \fBsinfo\fR +format string. Format strings transparently used by \fBsinfo\fR +when running with various options are +.RS +.TP 6 +.I "default" +"%9P %5a %.9l %.5D %6t %N" +.TP +.I "--summarize" +"%9P %5a %.9l %15F %N" +.TP +.I "--long" +"%9P %5a %.9l %.8s %4r %5h %10g %.5D %11T %N" +.TP +.I "--Node" +"%#N %.5D %9P %6t" +.TP +.I "--long --Node" +"%#N %.5D %9P %11T %.4c %.6m %.8d %.6w %8f %R" +.RE + +In the above format strings the use of "#" represents the maximum length of an node list to be printed. The field specifications available include: -.br -\fB%a\fR State/availability of a partition -.br -\fB%A\fR Number of nodes by state in the format "allocated/idle". +.RS +.TP 4 +\fB%a\fR +State/availability of a partition +.TP +\fB%A\fR +Number of nodes by state in the format "allocated/idle". Do not use this with a node state option ("%t" or "%T") or the different node states will be placed on separate lines. -.br -\fB%c\fR Number of CPUs per node -.br -\fB%d\fR Size of temporary disk space per node in megabytes -.br -\fB%D\fR Number of nodes -.br -\fB%f\fR Features associated with the nodes -.br -\fB%F\fR Number of nodes by state in the format "allocated/idle/other/total". +.TP +\fB%c\fR +Number of CPUs per node +.TP +\fB%d\fR +Size of temporary disk space per node in megabytes +.TP +\fB%D\fR +Number of nodes +.TP +\fB%f\fR +Features associated with the nodes +.TP +\fB%F\fR +Number of nodes by state in the format "allocated/idle/other/total". Do not use this with a node state option ("%t" or "%T") or the different node states will be placed on separate lines. -.br -\fB%g\fR Groups which may use the nodes -.br -\fB%h\fR Jobs may share nodes, "yes", "no", or "force" -.br -\fB%l\fR Maximum time for any job in the format "days:hours:minutes:seconds" -.br -\fB%m\fR Size of memory per node in megabytes -.br -\fB%N\fR List of node names -.br -\fB%P\fR Partition name -.br -\fB%r\fR Only user root may initiate jobs, "yes" or "no" -.br -\fB%R\fR The reason a node is unavailable (down, drained, or draining states) -.br -\fB%s\fR Maximum job size in nodes -.br -\fB%t\fR State of nodes, compact form -.br -\fB%T\fR State of nodes, extended form -.br -\fB%w\fR Scheduling weight of the nodes -.br -\fB%.<*>\fR right justification of the field -.br -\fB%<Number><*>\fR size of field +.TP +\fB%g\fR +Groups which may use the nodes +.TP +\fB%h\fR +Jobs may share nodes, "yes", "no", or "force" +.TP +\fB%l\fR +Maximum time for any job in the format "days:hours:minutes:seconds" +.TP +\fB%m\fR +Size of memory per node in megabytes +.TP +\fB%N\fR +List of node names +.TP +\fB%P\fR +Partition name +.TP +\fB%r\fR +Only user root may initiate jobs, "yes" or "no" +.TP +\fB%R\fR +The reason a node is unavailable (down, drained, or draining states) +.TP +\fB%s\fR +Maximum job size in nodes +.TP +\fB%t\fR +State of nodes, compact form +.TP +\fB%T\fR +State of nodes, extended form +.TP +\fB%w\fR +Scheduling weight of the nodes +.TP +\fB%.<*>\fR +right justification of the field +.TP +\fB%<Number><*>\fR +size of field +.RE .TP \fB\-r\fR, \fB\-\-responding\fR If set only report state information for responding nodes. diff --git a/src/sinfo/opts.c b/src/sinfo/opts.c index 4562e89e1270cdd2312692b2e3506f73d65e1513..aad8b13db4f659de1c6f31e32019f1df6bceb90b 100644 --- a/src/sinfo/opts.c +++ b/src/sinfo/opts.c @@ -81,6 +81,7 @@ extern void parse_command_line(int argc, char *argv[]) {"format", required_argument, 0, 'o'}, {"partition", required_argument, 0, 'p'}, {"responding",no_argument, 0, 'r'}, + {"list-reasons", no_argument, 0, 'R'}, {"summarize", no_argument, 0, 's'}, {"sort", required_argument, 0, 'S'}, {"states", required_argument, 0, 't'}, @@ -90,7 +91,7 @@ extern void parse_command_line(int argc, char *argv[]) {"usage", no_argument, 0, OPT_LONG_USAGE} }; - while((opt_char = getopt_long(argc, argv, "dehi:ln:No:p:rsS:t:vV", + while((opt_char = getopt_long(argc, argv, "dehi:ln:No:p:rRsS:t:vV", long_options, &option_index)) != -1) { switch (opt_char) { case (int)'?': @@ -133,6 +134,10 @@ extern void parse_command_line(int argc, char *argv[]) case (int) 'r': params.responding_nodes = true; break; + case (int) 'R': + params.list_reasons = true; + params.format = "%35R %N"; + break; case (int) 's': params.summarize = true; break; @@ -192,6 +197,11 @@ extern void parse_command_line(int argc, char *argv[]) } _parse_format( params.format ); + if (params.list_reasons && (params.state_list == NULL)) { + params.states = xstrdup ("down,drain"); + params.state_list = _build_state_list (params.states); + } + if (params.dead_nodes || params.nodes || params.partition || params.responding_nodes ||params.state_list) params.filtering = true; @@ -558,30 +568,32 @@ 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] [-delNrsv]\n"); + printf("\ +Usage: sinfo [-delNRrsv] [-i seconds] [-t states] [-p partition] [-n nodes]\n\ + [-S fields] [-o format] \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"); - printf(" -i, --iterate=seconds specify an interation period\n"); - printf(" -l, --long long output - displays more information\n"); - printf(" -n, --nodes=NODES report on specific node(s)\n"); - 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"); - printf(" -v, --verbose verbosity level\n"); - printf(" -V, --version output version information and exit\n"); - printf("\nHelp options:\n"); - printf(" --help show this help message\n"); - printf(" --usage display brief usage message\n"); + printf ("\ +Usage: sinfo [OPTIONS]\n\ + -d, --dead show only non-responding nodes\n\ + -e, --exact group nodes only on exact match of configuration\n\ + -h, --noheader no headers on output\n\ + -i, --iterate=seconds specify an interation period\n\ + -l, --long long output - displays more information\n\ + -n, --nodes=NODES report on specific node(s)\n\ + -N, --Node Node-centric format\n\ + -o, --format=format format specification\n\ + -p, --partition=PARTITION report on specific partition\n\ + -r, --responding report only responding nodes\n\ + -R, --list-reasons list reason nodes are down or drained\n\ + -s, --summarize report state summary only\n\ + -S, --sort=fields comma seperated list of fields to sort on\n\ + -t, --states=node_state specify the what states of nodes to view\n\ + -v, --verbose verbosity level\n\ + -V, --version output version information and exit\n\ +\nHelp options:\n\ + --help show this help message\n\ + --usage display brief usage message\n"); } diff --git a/src/sinfo/sinfo.h b/src/sinfo/sinfo.h index 1ec69ebf65b5a2d3c0238f0bff56d0ec04d96a93..6b461d010169923761e38ddb8e4898c03fc0b393 100644 --- a/src/sinfo/sinfo.h +++ b/src/sinfo/sinfo.h @@ -112,6 +112,7 @@ struct sinfo_parameters { bool node_field_flag; bool node_flag; bool responding_nodes; + bool list_reasons; bool summarize; struct sinfo_match_flags match_flags;