Skip to content
Snippets Groups Projects
Commit 7c5f0298 authored by Morris Jette's avatar Morris Jette
Browse files

sinfo: set default partition field size to that of longest name

parent 24aaa16f
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,8 @@ documents those changes that are of interest to users and admins.
run more than 256 jobs per node.
-- sched/backfill: Improve accuracy of expected job start with respect to
reservations.
-- sinfo partition field size will be set the the length of the longest
partition name by default.
* Changes in SLURM 2.5.0.pre1
=============================
......
RELEASE NOTES FOR SLURM VERSION 2.5
2 August 2012
7 August 2012
IMPORTANT NOTE:
......@@ -55,6 +55,8 @@ COMMAND CHANGES (see man pages for details)
- Add reservation flag of "Part_Nodes" to allocate all nodes in a partition to
a reservation and automatically change the reservation when nodes are
added to or removed from the reservation.
- sinfo partition field size will be set the the length of the longest
partition name by default.
OTHER CHANGES
=============
......
.TH SINFO "1" "April 2012" "sinfo 2.4" "Slurm components"
.TH SINFO "1" "August 2012" "sinfo 2.5" "Slurm components"
.SH "NAME"
sinfo \- view information about SLURM nodes and partitions.
......@@ -84,13 +84,13 @@ when running with various options are
.RS
.TP 15
.I "default"
"%9P %5a %.10l %.5D %6t %N"
"%P %5a %.10l %.5D %6t %N"
.TP
.I "\-\-summarize"
"%9P %5a %.10l %16F %N"
"%P %5a %.10l %16F %N"
.TP
.I "\-\-long"
"%9P %5a %.10l %.8s %4r %5h %10g %.5D %11T %N"
"%P %5a %.10l %.8s %4r %5h %10g %.5D %11T %N"
.TP
.I "\-\-Node"
"%N %.5D %9P %6t"
......
......@@ -266,12 +266,14 @@ extern void parse_command_line(int argc, char *argv[])
if ( params.format == NULL ) {
if ( params.summarize ) {
if(params.cluster_flags & CLUSTER_FLAG_BG)
params.part_field_flag = true; /* compute size later */
if (params.cluster_flags & CLUSTER_FLAG_BG)
params.format = "%9P %.5a %.10l %.32F %N";
else
params.format = "%9P %.5a %.10l %.16F %N";
} else if ( params.node_flag ) {
params.node_field_flag = true; /* compute size later */
params.part_field_flag = true; /* compute size later */
params.format = params.long_output ?
"%N %.6D %.9P %.11T %.4c %.8z %.6m %.8d %.6w %.8f %20E" :
"%N %.6D %.9P %6t";
......@@ -285,6 +287,7 @@ extern void parse_command_line(int argc, char *argv[])
params.format = xstrdup(env_val);
} else {
params.part_field_flag = true; /* compute size later */
params.format = params.long_output ?
"%9P %.5a %.10l %.10s %.4r %.5h %.10g %.6D %.11T %N" :
"%9P %.5a %.10l %.6D %.6t %N";
......@@ -799,6 +802,8 @@ void _print_options( void )
"true" : "false");
printf("node_format = %s\n", params.node_flag ? "true" : "false");
printf("nodes = %s\n", params.nodes ? params.nodes : "n/a");
printf("part_field = %s\n", params.part_field_flag ?
"true" : "false");
printf("partition = %s\n", params.partition ?
params.partition: "n/a");
printf("responding = %s\n", params.responding_nodes ?
......
......@@ -55,6 +55,7 @@
#include "src/sinfo/sinfo.h"
#define MIN_NODE_FIELD_SIZE 9
#define MIN_PART_FIELD_SIZE 9
static int _build_min_max_16_string(char *buffer, int buf_size,
uint16_t min, uint16_t max, bool range);
......@@ -66,6 +67,7 @@ static int _print_secs(long time, int width, bool right, bool cut_output);
static int _print_str(char *str, int width, bool right, bool cut_output);
static int _resv_name_width(reserve_info_t *resv_ptr);
static void _set_node_field_size(List sinfo_list);
static void _set_part_field_size(List sinfo_list);
static char *_str_tolower(char *upper_str);
/*****************************************************************************
......@@ -86,6 +88,8 @@ int print_sinfo_list(List sinfo_list)
if (params.node_field_flag)
_set_node_field_size(sinfo_list);
if (params.part_field_flag)
_set_part_field_size(sinfo_list);
if (!params.no_header)
print_sinfo_entry(NULL);
......@@ -312,6 +316,22 @@ static void _set_node_field_size(List sinfo_list)
params.node_field_size = max_width;
}
static void _set_part_field_size(List sinfo_list)
{
ListIterator i = list_iterator_create(sinfo_list);
sinfo_data_t *current;
int max_width = MIN_PART_FIELD_SIZE, this_width = 0;
while ((current = (sinfo_data_t *) list_next(i)) != NULL) {
if (!current->part_info || !current->part_info->name)
continue;
this_width = strlen(current->part_info->name);
max_width = MAX(max_width, this_width);
}
list_iterator_destroy(i);
params.part_field_size = max_width;
}
/*
* _str_tolower - convert string to all lower case
* upper_str IN - upper case input string
......@@ -759,6 +779,8 @@ int _print_nodes_aiot(sinfo_data_t * sinfo_data, int width,
int _print_partition(sinfo_data_t * sinfo_data, int width,
bool right_justify, char *suffix)
{
if (params.part_field_flag)
width = params.part_field_size;
if (sinfo_data) {
if (sinfo_data->part_info == NULL)
_print_str("n/a", width, right_justify, true);
......@@ -785,6 +807,8 @@ int _print_partition(sinfo_data_t * sinfo_data, int width,
int _print_partition_name(sinfo_data_t * sinfo_data, int width,
bool right_justify, char *suffix)
{
if (params.part_field_flag)
width = params.part_field_size;
if (sinfo_data) {
if (sinfo_data->part_info == NULL)
_print_str("n/a", width, right_justify, true);
......
......@@ -160,6 +160,7 @@ struct sinfo_parameters {
bool no_header;
bool node_field_flag;
bool node_flag;
bool part_field_flag;
bool reservation_flag;
bool responding_nodes;
bool list_reasons;
......@@ -174,6 +175,7 @@ struct sinfo_parameters {
int iterate;
int node_field_size;
int part_field_size;
int verbose;
List format_list;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment