View | Details | Raw Unified | Return to ticket 5353
Collapse All | Expand All

(-)a/src/sinfo/opts.c (-8 / +69 lines)
Lines 59-64 Link Here
59
#define OPT_LONG_LOCAL     0x103
59
#define OPT_LONG_LOCAL     0x103
60
#define OPT_LONG_NOCONVERT 0x104
60
#define OPT_LONG_NOCONVERT 0x104
61
#define OPT_LONG_FEDR      0x105
61
#define OPT_LONG_FEDR      0x105
62
#define OPT_LONG_PARSEABLE 0x106
62
63
63
/* FUNCTIONS */
64
/* FUNCTIONS */
64
static List  _build_state_list( char* str );
65
static List  _build_state_list( char* str );
Lines 93-98 extern void parse_command_line(int argc, char **argv) Link Here
93
	static struct option long_options[] = {
94
	static struct option long_options[] = {
94
		{"all",       no_argument,       0, 'a'},
95
		{"all",       no_argument,       0, 'a'},
95
		{"dead",      no_argument,       0, 'd'},
96
		{"dead",      no_argument,       0, 'd'},
97
		{"delimiter", required_argument, 0, 'D'},
96
		{"exact",     no_argument,       0, 'e'},
98
		{"exact",     no_argument,       0, 'e'},
97
		{"federation",no_argument,       0, OPT_LONG_FEDR},
99
		{"federation",no_argument,       0, OPT_LONG_FEDR},
98
		{"help",      no_argument,       0, OPT_LONG_HELP},
100
		{"help",      no_argument,       0, OPT_LONG_HELP},
Lines 109-114 extern void parse_command_line(int argc, char **argv) Link Here
109
		{"format",    required_argument, 0, 'o'},
111
		{"format",    required_argument, 0, 'o'},
110
		{"Format",    required_argument, 0, 'O'},
112
		{"Format",    required_argument, 0, 'O'},
111
		{"partition", required_argument, 0, 'p'},
113
		{"partition", required_argument, 0, 'p'},
114
		{"parseable", no_argument,       0, OPT_LONG_PARSEABLE},
112
		{"responding",no_argument,       0, 'r'},
115
		{"responding",no_argument,       0, 'r'},
113
		{"list-reasons", no_argument,    0, 'R'},
116
		{"list-reasons", no_argument,    0, 'R'},
114
		{"summarize", no_argument,       0, 's'},
117
		{"summarize", no_argument,       0, 's'},
Lines 157-164 extern void parse_command_line(int argc, char **argv) Link Here
157
		params.local = true;
160
		params.local = true;
158
	}
161
	}
159
162
163
	params.field_delimiter = NULL;
164
	params.should_show_parseable = false;
165
160
	while ((opt_char = getopt_long(argc, argv,
166
	while ((opt_char = getopt_long(argc, argv,
161
				       "adehi:lM:n:No:O:p:rRsS:t:TvV",
167
				       "adD:ehi:lM:n:No:O:p:rRsS:t:TvV",
162
				       long_options, &option_index)) != -1) {
168
				       long_options, &option_index)) != -1) {
163
		switch (opt_char) {
169
		switch (opt_char) {
164
		case (int)'?':
170
		case (int)'?':
Lines 175-180 extern void parse_command_line(int argc, char **argv) Link Here
175
		case (int)'d':
181
		case (int)'d':
176
			params.dead_nodes = true;
182
			params.dead_nodes = true;
177
			break;
183
			break;
184
		case (int)'D':
185
			if ( optarg ) {
186
				if ( params.field_delimiter )
187
					xfree(params.field_delimiter);
188
				params.field_delimiter = xstrdup(optarg);
189
			}
190
			break;
178
		case (int)'e':
191
		case (int)'e':
179
			params.exact_match = true;
192
			params.exact_match = true;
180
			break;
193
			break;
Lines 246-251 extern void parse_command_line(int argc, char **argv) Link Here
246
			params.part_list = _build_part_list(optarg);
259
			params.part_list = _build_part_list(optarg);
247
			params.all_flag = true;
260
			params.all_flag = true;
248
			break;
261
			break;
262
		case OPT_LONG_PARSEABLE:
263
			params.should_show_parseable = true;
264
			break;
249
		case (int) 'r':
265
		case (int) 'r':
250
			params.responding_nodes = true;
266
			params.responding_nodes = true;
251
			break;
267
			break;
Lines 349-354 extern void parse_command_line(int argc, char **argv) Link Here
349
		}
365
		}
350
	}
366
	}
351
367
368
	/* If parseable output was chosen, make sure there's a delimiter: */
369
	if ( params.should_show_parseable && (params.field_delimiter == NULL) )
370
		params.field_delimiter = xstrdup("|");
371
352
	if (long_form)
372
	if (long_form)
353
		_parse_long_format(params.format);
373
		_parse_long_format(params.format);
354
	else
374
	else
Lines 612-617 _parse_format( char* format ) Link Here
612
	while (token) {
632
	while (token) {
613
		_parse_token( token, field, &field_size, &right_justify,
633
		_parse_token( token, field, &field_size, &right_justify,
614
			      &suffix);
634
			      &suffix);
635
636
		if ( params.should_show_parseable ) {
637
			field_size = 0;
638
			right_justify = false;
639
			if ( suffix )
640
				xfree(suffix);
641
			suffix = NULL;
642
		}
643
615
		if        (field[0] == 'a') {
644
		if        (field[0] == 'a') {
616
			params.match_flags.avail_flag = true;
645
			params.match_flags.avail_flag = true;
617
			format_add_avail( params.format_list,
646
			format_add_avail( params.format_list,
Lines 900-905 static int _parse_long_format (char* format_long) Link Here
900
		_parse_long_token( token, sep, &field_size, &right_justify,
929
		_parse_long_token( token, sep, &field_size, &right_justify,
901
				   &suffix);
930
				   &suffix);
902
931
932
		if ( params.should_show_parseable ) {
933
			field_size = 0;
934
			right_justify = false;
935
			if ( suffix )
936
				xfree(suffix);
937
			suffix = NULL;
938
		}
939
903
		if (!xstrcasecmp(token, "all")) {
940
		if (!xstrcasecmp(token, "all")) {
904
			_parse_format ("%all");
941
			_parse_format ("%all");
905
		} else if (!xstrcasecmp(token, "allocmem")) {
942
		} else if (!xstrcasecmp(token, "allocmem")) {
Lines 1241-1254 _parse_long_token( char *token, char *sep, int *field_size, bool *right_justify, Link Here
1241
	xassert(token);
1278
	xassert(token);
1242
	ptr = strchr(token, ':');
1279
	ptr = strchr(token, ':');
1243
	if (ptr) {
1280
	if (ptr) {
1244
		ptr[0] = '\0';
1281
		char    *endptr;
1245
		if (ptr[1] == '.') {
1282
		long    value;
1283
1284
		*ptr = '\0';
1285
		ptr++;
1286
		if (*ptr == '.') {
1246
			*right_justify = true;
1287
			*right_justify = true;
1247
			ptr++;
1288
			ptr++;
1248
		} else {
1289
		} else {
1249
			*right_justify = false;
1290
			*right_justify = false;
1250
		}
1291
		}
1251
		*field_size = atoi(ptr + 1);
1292
		/* Default width = 0 (what atoi() would have returned for an
1293
		* invalid integer string).  No suffix by default.
1294
		*
1295
		* See if there's an integer we can parse; if so, that's the
1296
		* width and what's left is the suffix.  If there was no integer
1297
		* to parse, the string left at ptr is the suffix.
1298
		*/
1299
		value = strtol(ptr, &endptr, 10);
1300
		*suffix = NULL;
1301
		*field_size = 0;
1302
		if ( endptr > ptr ) {
1303
			*field_size = value;
1304
			ptr = endptr;
1305
		}
1306
		if ( *ptr )
1307
			*suffix = xstrdup(ptr);
1252
	} else {
1308
	} else {
1253
		*right_justify = false;
1309
		*right_justify = false;
1254
		*field_size = 20;
1310
		*field_size = 20;
Lines 1260-1265 void _print_options( void ) Link Here
1260
{
1316
{
1261
	printf("-----------------------------\n");
1317
	printf("-----------------------------\n");
1262
	printf("dead        = %s\n", params.dead_nodes ? "true" : "false");
1318
	printf("dead        = %s\n", params.dead_nodes ? "true" : "false");
1319
	printf("delimiter   = %s\n", params.field_delimiter );
1263
	printf("exact       = %d\n", params.exact_match);
1320
	printf("exact       = %d\n", params.exact_match);
1264
	printf("filtering   = %s\n", params.filtering ? "true" : "false");
1321
	printf("filtering   = %s\n", params.filtering ? "true" : "false");
1265
	printf("format      = %s\n", params.format);
1322
	printf("format      = %s\n", params.format);
Lines 1274-1279 void _print_options( void ) Link Here
1274
					"true" : "false");
1331
					"true" : "false");
1275
	printf("partition   = %s\n", params.partition ?
1332
	printf("partition   = %s\n", params.partition ?
1276
					params.partition: "n/a");
1333
					params.partition: "n/a");
1334
	printf("parseable   = %s\n", params.should_show_parseable ? "true" : "false");
1277
	printf("responding  = %s\n", params.responding_nodes ?
1335
	printf("responding  = %s\n", params.responding_nodes ?
1278
					"true" : "false");
1336
					"true" : "false");
1279
	printf("states      = %s\n", params.states);
1337
	printf("states      = %s\n", params.states);
Lines 1340-1347 void _print_options( void ) Link Here
1340
static void _usage( void )
1398
static void _usage( void )
1341
{
1399
{
1342
	printf("\
1400
	printf("\
1343
Usage: sinfo [-abdelNRrsTv] [-i seconds] [-t states] [-p partition] [-n nodes]\n\
1401
Usage: sinfo [-abdelNRrsTv] [-D delim] [-i seconds] [-t states] [-p partition]\n\
1344
             [-S fields] [-o format] [-O Format] [--federation] [--local]\n");
1402
              [-n nodes] [-S fields] [-o format] [-O Format] [--federation]\n\
1403
              [--parseable] [--local]\n");
1345
}
1404
}
1346
1405
1347
static void _help( void )
1406
static void _help( void )
Lines 1351-1360 Usage: sinfo [OPTIONS]\n\ Link Here
1351
  -a, --all                  show all partitions (including hidden and those\n\
1410
  -a, --all                  show all partitions (including hidden and those\n\
1352
			     not accessible)\n\
1411
			     not accessible)\n\
1353
  -d, --dead                 show only non-responding nodes\n\
1412
  -d, --dead                 show only non-responding nodes\n\
1413
  -D, --delimiter=DELIM      print DELIM between each output field\n\
1354
  -e, --exact                group nodes only on exact match of configuration\n\
1414
  -e, --exact                group nodes only on exact match of configuration\n\
1355
      --federation           Report federated information if a member of one\n\
1415
      --federation           Report federated information if a member of one\n\
1356
  -h, --noheader             no headers on output\n\
1416
  -h, --noheader             no headers on output\n\
1357
  --hide                     do not show hidden or non-accessible partitions\n\
1417
      --hide                 do not show hidden or non-accessible partitions\n\
1358
  -i, --iterate=seconds      specify an iteration period\n\
1418
  -i, --iterate=seconds      specify an iteration period\n\
1359
      --local                show only local cluster in a federation.\n\
1419
      --local                show only local cluster in a federation.\n\
1360
                             Overrides --federation.\n\
1420
                             Overrides --federation.\n\
Lines 1362-1373 Usage: sinfo [OPTIONS]\n\ Link Here
1362
  -M, --clusters=names       clusters to issue commands to. Implies --local.\n\
1422
  -M, --clusters=names       clusters to issue commands to. Implies --local.\n\
1363
                             NOTE: SlurmDBD must be up.\n\
1423
                             NOTE: SlurmDBD must be up.\n\
1364
  -n, --nodes=NODES          report on specific node(s)\n\
1424
  -n, --nodes=NODES          report on specific node(s)\n\
1365
  --noconvert                don't convert units from their original type\n\
1425
      --noconvert            don't convert units from their original type\n\
1366
			     (e.g. 2048M won't be converted to 2G).\n\
1426
			     (e.g. 2048M won't be converted to 2G).\n\
1367
  -N, --Node                 Node-centric format\n\
1427
  -N, --Node                 Node-centric format\n\
1368
  -o, --format=format        format specification\n\
1428
  -o, --format=format        format specification\n\
1369
  -O, --Format=format        long format specification\n\
1429
  -O, --Format=format        long format specification\n\
1370
  -p, --partition=PARTITION  report on specific partition\n\
1430
  -p, --partition=PARTITION  report on specific partition\n\
1431
      --parseable            display output suitable for machine parsing\n\
1371
  -r, --responding           report only responding nodes\n\
1432
  -r, --responding           report only responding nodes\n\
1372
  -R, --list-reasons         list reason nodes are down or drained\n\
1433
  -R, --list-reasons         list reason nodes are down or drained\n\
1373
  -s, --summarize            report state summary only\n\
1434
  -s, --summarize            report state summary only\n\
(-)a/src/sinfo/print.c (-8 / +19 lines)
Lines 94-103 int print_sinfo_list(List sinfo_list) Link Here
94
	ListIterator i = list_iterator_create(sinfo_list);
94
	ListIterator i = list_iterator_create(sinfo_list);
95
	sinfo_data_t *current;
95
	sinfo_data_t *current;
96
96
97
	if (params.node_field_flag)
97
	if ( ! params.should_show_parseable ) {
98
		_set_node_field_size(sinfo_list);
98
		if (params.node_field_flag)
99
	if (params.part_field_flag)
99
			_set_node_field_size(sinfo_list);
100
		_set_part_field_size(sinfo_list);
100
		if (params.part_field_flag)
101
			_set_part_field_size(sinfo_list);
102
	}
101
103
102
	if (!params.no_header)
104
	if (!params.no_header)
103
		print_sinfo_entry(NULL);
105
		print_sinfo_entry(NULL);
Lines 113-129 int print_sinfo_entry(sinfo_data_t *sinfo_data) Link Here
113
{
115
{
114
	ListIterator i = list_iterator_create(params.format_list);
116
	ListIterator i = list_iterator_create(params.format_list);
115
	sinfo_format_t *current;
117
	sinfo_format_t *current;
118
	int rc = SLURM_SUCCESS;
116
119
117
	while ((current = (sinfo_format_t *) list_next(i)) != NULL) {
120
	current = (sinfo_format_t *) list_next(i);
121
	while ( current != NULL ) {
118
		if (current->function(sinfo_data, current->width,
122
		if (current->function(sinfo_data, current->width,
119
				      current->right_justify, current->suffix)
123
				      current->right_justify, current->suffix)
120
		    != SLURM_SUCCESS)
124
		    != SLURM_SUCCESS)
121
			return SLURM_ERROR;
125
		{
126
			rc = SLURM_ERROR;
127
			break;
128
		}
129
130
		current = (sinfo_format_t *) list_next(i);
131
		if ( (params.field_delimiter != NULL) && (current != NULL) )
132
			fputs(params.field_delimiter, stdout);
122
	}
133
	}
123
	list_iterator_destroy(i);
134
	list_iterator_destroy(i);
124
125
	printf("\n");
135
	printf("\n");
126
	return SLURM_SUCCESS;
136
137
	return rc;
127
}
138
}
128
139
129
void print_sinfo_reservation(reserve_info_msg_t *resv_ptr)
140
void print_sinfo_reservation(reserve_info_msg_t *resv_ptr)
(-)a/src/sinfo/sinfo.h (+3 lines)
Lines 189-194 struct sinfo_parameters { Link Here
189
	int part_field_size;
189
	int part_field_size;
190
	int verbose;
190
	int verbose;
191
191
192
	char* field_delimiter;
193
	bool  should_show_parseable;
194
192
	List  part_list;
195
	List  part_list;
193
	List  format_list;
196
	List  format_list;
194
	List  state_list;
197
	List  state_list;
(-)a/src/squeue/opts.c (-9 / +70 lines)
Lines 64-69 Link Here
64
#define OPT_LONG_LOCAL        0x106
64
#define OPT_LONG_LOCAL        0x106
65
#define OPT_LONG_SIBLING      0x107
65
#define OPT_LONG_SIBLING      0x107
66
#define OPT_LONG_FEDR         0x108
66
#define OPT_LONG_FEDR         0x108
67
#define OPT_LONG_PARSEABLE    0x109
67
68
68
/* FUNCTIONS */
69
/* FUNCTIONS */
69
static List  _build_job_list( char* str );
70
static List  _build_job_list( char* str );
Lines 99-104 parse_command_line( int argc, char* *argv ) Link Here
99
		{"all",        no_argument,       0, 'a'},
100
		{"all",        no_argument,       0, 'a'},
100
		{"array",      no_argument,       0, 'r'},
101
		{"array",      no_argument,       0, 'r'},
101
		{"array-unique",no_argument,      0, OPT_LONG_ARRAY_UNIQUE},
102
		{"array-unique",no_argument,      0, OPT_LONG_ARRAY_UNIQUE},
103
		{"delimiter",  required_argument, 0, 'D'},
102
		{"Format",     required_argument, 0, 'O'},
104
		{"Format",     required_argument, 0, 'O'},
103
		{"format",     required_argument, 0, 'o'},
105
		{"format",     required_argument, 0, 'o'},
104
		{"federation", no_argument,       0, OPT_LONG_FEDR},
106
		{"federation", no_argument,       0, OPT_LONG_FEDR},
Lines 112-124 parse_command_line( int argc, char* *argv ) Link Here
112
		{"cluster",    required_argument, 0, 'M'},
114
		{"cluster",    required_argument, 0, 'M'},
113
		{"clusters",   required_argument, 0, 'M'},
115
		{"clusters",   required_argument, 0, 'M'},
114
		{"name",       required_argument, 0, 'n'},
116
		{"name",       required_argument, 0, 'n'},
115
                {"noconvert",  no_argument,       0, OPT_LONG_NOCONVERT},
117
		{"noconvert",  no_argument,       0, OPT_LONG_NOCONVERT},
116
		{"node",       required_argument, 0, 'w'},
118
		{"node",       required_argument, 0, 'w'},
117
		{"nodes",      required_argument, 0, 'w'},
119
		{"nodes",      required_argument, 0, 'w'},
118
		{"nodelist",   required_argument, 0, 'w'},
120
		{"nodelist",   required_argument, 0, 'w'},
119
		{"noheader",   no_argument,       0, 'h'},
121
		{"noheader",   no_argument,       0, 'h'},
120
		{"partitions", required_argument, 0, 'p'},
122
		{"partitions", required_argument, 0, 'p'},
121
		{"priority",   no_argument,       0, 'P'},
123
		{"priority",   no_argument,       0, 'P'},
124
		{"parseable",  no_argument,       0, OPT_LONG_PARSEABLE},
122
		{"qos",        required_argument, 0, 'q'},
125
		{"qos",        required_argument, 0, 'q'},
123
		{"reservation",required_argument, 0, 'R'},
126
		{"reservation",required_argument, 0, 'R'},
124
		{"sib",        no_argument,       0, OPT_LONG_SIBLING},
127
		{"sib",        no_argument,       0, OPT_LONG_SIBLING},
Lines 165-172 parse_command_line( int argc, char* *argv ) Link Here
165
		params.priority_flag = true;
168
		params.priority_flag = true;
166
	if (getenv("SQUEUE_SIB") || getenv("SQUEUE_SIBLING"))
169
	if (getenv("SQUEUE_SIB") || getenv("SQUEUE_SIBLING"))
167
		params.sibling_flag = true;
170
		params.sibling_flag = true;
171
172
	params.field_delimiter = NULL;
173
	params.should_show_parseable = false;
174
168
	while ((opt_char = getopt_long(argc, argv,
175
	while ((opt_char = getopt_long(argc, argv,
169
				       "A:ahi:j::lL:n:M:O:o:p:Pq:R:rs::S:t:u:U:vVw:",
176
				       "A:aD:hi:j::lL:n:M:O:o:p:Pq:R:rs::S:t:u:U:vVw:",
170
				       long_options, &option_index)) != -1) {
177
				       long_options, &option_index)) != -1) {
171
		switch (opt_char) {
178
		switch (opt_char) {
172
		case (int)'?':
179
		case (int)'?':
Lines 183-188 parse_command_line( int argc, char* *argv ) Link Here
183
		case (int)'a':
190
		case (int)'a':
184
			params.all_flag = true;
191
			params.all_flag = true;
185
			break;
192
			break;
193
		case (int)'D':
194
			if ( optarg ) {
195
				if ( params.field_delimiter )
196
					xfree(params.field_delimiter);
197
				params.field_delimiter = xstrdup(optarg);
198
			}
199
			break;
186
		case (int)'h':
200
		case (int)'h':
187
			params.no_header = true;
201
			params.no_header = true;
188
			break;
202
			break;
Lines 259-264 parse_command_line( int argc, char* *argv ) Link Here
259
		case (int) 'P':
273
		case (int) 'P':
260
			params.priority_flag = true;
274
			params.priority_flag = true;
261
			break;
275
			break;
276
		case OPT_LONG_PARSEABLE:
277
			params.should_show_parseable = true;
278
			break;
262
		case (int) 'q':
279
		case (int) 'q':
263
			xfree(params.qoss);
280
			xfree(params.qoss);
264
			params.qoss = xstrdup(optarg);
281
			params.qoss = xstrdup(optarg);
Lines 489-494 parse_command_line( int argc, char* *argv ) Link Here
489
		list_iterator_destroy(iterator);
506
		list_iterator_destroy(iterator);
490
	}
507
	}
491
508
509
	/* If parseable output was chosen, make sure there's a delimiter: */
510
	if ( params.should_show_parseable && (params.field_delimiter == NULL) )
511
		params.field_delimiter = xstrdup("|");
512
492
	if ( params.verbose )
513
	if ( params.verbose )
493
		_print_options();
514
		_print_options();
494
}
515
}
Lines 581-586 extern int parse_format( char* format ) Link Here
581
	while (token) {
602
	while (token) {
582
		_parse_token( token, field, &field_size, &right_justify,
603
		_parse_token( token, field, &field_size, &right_justify,
583
			      &suffix);
604
			      &suffix);
605
606
		if ( params.should_show_parseable ) {
607
			field_size = 0;
608
			right_justify = false;
609
			if ( suffix )
610
				xfree(suffix);
611
			suffix = NULL;
612
		}
613
584
		if (params.step_flag) {
614
		if (params.step_flag) {
585
			if      (field[0] == 'A')
615
			if      (field[0] == 'A')
586
				step_format_add_num_tasks( params.format_list,
616
				step_format_add_num_tasks( params.format_list,
Lines 959-964 extern int parse_long_format( char* format_long ) Link Here
959
		_parse_long_token( token, sep, &field_size, &right_justify,
989
		_parse_long_token( token, sep, &field_size, &right_justify,
960
				   &suffix);
990
				   &suffix);
961
991
992
		if ( params.should_show_parseable ) {
993
			field_size = 0;
994
			right_justify = false;
995
			if ( suffix )
996
				xfree(suffix);
997
			suffix = NULL;
998
		}
999
962
		if (params.step_flag) {
1000
		if (params.step_flag) {
963
1001
964
			if (!xstrcasecmp(token, "cluster"))
1002
			if (!xstrcasecmp(token, "cluster"))
Lines 1787-1800 _parse_long_token( char *token, char *sep, int *field_size, bool *right_justify, Link Here
1787
	xassert(token);
1825
	xassert(token);
1788
	ptr = strchr(token, ':');
1826
	ptr = strchr(token, ':');
1789
	if (ptr) {
1827
	if (ptr) {
1790
		ptr[0] = '\0';
1828
		char    *endptr;
1791
		if (ptr[1] == '.') {
1829
		long    value;
1830
1831
		*ptr = '\0';
1832
		ptr++;
1833
		if (*ptr == '.') {
1792
			*right_justify = true;
1834
			*right_justify = true;
1793
			ptr++;
1835
			ptr++;
1794
		} else {
1836
		} else {
1795
			*right_justify = false;
1837
			*right_justify = false;
1796
		}
1838
		}
1797
		*field_size = atoi(ptr + 1);
1839
		/* Default width = 0 (what atoi() would have returned for an
1840
		* invalid integer string).  No suffix by default.
1841
		*
1842
		* See if there's an integer we can parse; if so, that's the
1843
		* width and what's left is the suffix.  If there was no integer
1844
		* to parse, the string left at ptr is the suffix.
1845
		*/
1846
		value = strtol(ptr, &endptr, 10);
1847
		*suffix = NULL;
1848
		*field_size = 0;
1849
		if ( endptr > ptr ) {
1850
			*field_size = value;
1851
			ptr = endptr;
1852
		}
1853
		if ( *ptr )
1854
			*suffix = xstrdup(ptr);
1798
	} else {
1855
	} else {
1799
		*right_justify = false;
1856
		*right_justify = false;
1800
		*field_size = 20;
1857
		*field_size = 20;
Lines 1822-1827 _print_options(void) Link Here
1822
	printf( "-----------------------------\n" );
1879
	printf( "-----------------------------\n" );
1823
	printf( "all         = %s\n", params.all_flag ? "true" : "false");
1880
	printf( "all         = %s\n", params.all_flag ? "true" : "false");
1824
	printf( "array       = %s\n", params.array_flag ? "true" : "false");
1881
	printf( "array       = %s\n", params.array_flag ? "true" : "false");
1882
	printf( "delimiter   = %s\n", params.field_delimiter );
1825
	printf( "federation  = %s\n", params.federation_flag ? "true":"false");
1883
	printf( "federation  = %s\n", params.federation_flag ? "true":"false");
1826
	printf( "format      = %s\n", params.format );
1884
	printf( "format      = %s\n", params.format );
1827
	printf( "iterate     = %d\n", params.iterate );
1885
	printf( "iterate     = %d\n", params.iterate );
Lines 1831-1840 _print_options(void) Link Here
1831
	printf( "local       = %s\n", params.local_flag ? "true" : "false");
1889
	printf( "local       = %s\n", params.local_flag ? "true" : "false");
1832
	printf( "names       = %s\n", params.names );
1890
	printf( "names       = %s\n", params.names );
1833
	printf( "nodes       = %s\n", hostlist ) ;
1891
	printf( "nodes       = %s\n", hostlist ) ;
1892
	printf( "parseable   = %s\n", params.should_show_parseable ? "true" : "false");
1834
	printf( "partitions  = %s\n", params.partitions ) ;
1893
	printf( "partitions  = %s\n", params.partitions ) ;
1835
	printf( "priority    = %s\n", params.priority_flag ? "true" : "false");
1894
	printf( "priority    = %s\n", params.priority_flag ? "true" : "false");
1836
	printf( "reservation = %s\n", params.reservation ) ;
1895
	printf( "reservation = %s\n", params.reservation ) ;
1837
	printf( "sibling      = %s\n", params.sibling_flag ? "true" : "false");
1896
	printf( "sibling     = %s\n", params.sibling_flag ? "true" : "false");
1838
	printf( "sort        = %s\n", params.sort ) ;
1897
	printf( "sort        = %s\n", params.sort ) ;
1839
	printf( "start_flag  = %d\n", params.start_flag );
1898
	printf( "start_flag  = %d\n", params.start_flag );
1840
	printf( "states      = %s\n", params.states ) ;
1899
	printf( "states      = %s\n", params.states ) ;
Lines 2146-2155 _build_user_list( char* str ) Link Here
2146
static void _usage(void)
2205
static void _usage(void)
2147
{
2206
{
2148
	printf("\
2207
	printf("\
2149
Usage: squeue [-A account] [--clusters names] [-i seconds] [--job jobid]\n\
2208
Usage: squeue [-A account] [--clusters names] [-D delim] [-i seconds]\n\
2150
              [-n name] [-o format] [-p partitions] [--qos qos]\n\
2209
              [--job jobid] [-n name] [-o format] [-p partitions] [--qos qos]\n\
2151
              [--reservation reservation] [--sort fields] [--start]\n\
2210
              [--reservation reservation] [--sort fields] [--start]\n\
2152
              [--step step_id] [-t states] [-u user_name] [--usage]\n\
2211
              [--step step_id] [-t states] [-u user_name] [--usage] [--parseable]\n\
2153
              [-L licenses] [-w nodes] [--federation] [--local] [--sibling]\n\
2212
              [-L licenses] [-w nodes] [--federation] [--local] [--sibling]\n\
2154
	      [-ahjlrsv]\n");
2213
	      [-ahjlrsv]\n");
2155
}
2214
}
Lines 2163-2168 Usage: squeue [OPTIONS]\n\ Link Here
2163
  -a, --all                       display jobs in hidden partitions\n\
2222
  -a, --all                       display jobs in hidden partitions\n\
2164
      --array-unique              display one unique pending job array\n\
2223
      --array-unique              display one unique pending job array\n\
2165
                                  element per line\n\
2224
                                  element per line\n\
2225
  -D, --delimiter=DELIM           print DELIM between each output field\n\
2166
      --federation                Report federated information if a member\n\
2226
      --federation                Report federated information if a member\n\
2167
                                  of one\n\
2227
                                  of one\n\
2168
  -h, --noheader                  no headers on output\n\
2228
  -h, --noheader                  no headers on output\n\
Lines 2184-2189 Usage: squeue [OPTIONS]\n\ Link Here
2184
  -O, --Format=format             format specification\n\
2244
  -O, --Format=format             format specification\n\
2185
  -p, --partition=partition(s)    comma separated list of partitions\n\
2245
  -p, --partition=partition(s)    comma separated list of partitions\n\
2186
				  to view, default is all partitions\n\
2246
				  to view, default is all partitions\n\
2247
      --parseable                 display output suitable for machine parsing\n\
2187
  -q, --qos=qos(s)                comma separated list of qos's\n\
2248
  -q, --qos=qos(s)                comma separated list of qos's\n\
2188
				  to view, default is all qos's\n\
2249
				  to view, default is all qos's\n\
2189
  -R, --reservation=name          reservation to view, default is all\n\
2250
  -R, --reservation=name          reservation to view, default is all\n\
(-)a/src/squeue/print.c (-7 / +25 lines)
Lines 401-422 static int _print_one_job_from_format(job_info_t * job, List list) Link Here
401
	ListIterator iter = list_iterator_create(list);
401
	ListIterator iter = list_iterator_create(list);
402
	job_format_t *current;
402
	job_format_t *current;
403
	int total_width = 0;
403
	int total_width = 0;
404
	int rc = SLURM_SUCCESS;
404
405
405
	while ((current = (job_format_t *) list_next(iter)) != NULL) {
406
	current = (job_format_t *) list_next(iter);
407
	while (current != NULL) {
406
		if (current->
408
		if (current->
407
		    function(job, current->width, current->right_justify,
409
		    function(job, current->width, current->right_justify,
408
			     current->suffix)
410
			     current->suffix)
409
		    != SLURM_SUCCESS)
411
		    != SLURM_SUCCESS)
410
			return SLURM_ERROR;
412
		{
413
			rc = SLURM_ERROR;
414
			break;
415
		}
411
		if (current->width)
416
		if (current->width)
412
			total_width += (current->width + 1);
417
			total_width += (current->width + 1);
413
		else
418
		else
414
			total_width += 10;
419
			total_width += 10;
420
421
		current = (job_format_t *) list_next(iter);
422
		if ( (params.field_delimiter != NULL) && (current != NULL) )
423
			fputs(params.field_delimiter, stdout);
415
	}
424
	}
416
	list_iterator_destroy(iter);
425
	list_iterator_destroy(iter);
417
418
	printf("\n");
426
	printf("\n");
419
	return SLURM_SUCCESS;
427
428
	return rc;
420
}
429
}
421
430
422
static int _print_job_from_format(void *x, void *arg)
431
static int _print_job_from_format(void *x, void *arg)
Lines 2303-2324 static int _print_step_from_format(void *x, void *arg) Link Here
2303
	ListIterator i = list_iterator_create(list);
2312
	ListIterator i = list_iterator_create(list);
2304
	step_format_t *current;
2313
	step_format_t *current;
2305
	int total_width = 0;
2314
	int total_width = 0;
2315
	int rc = SLURM_SUCCESS;
2306
2316
2307
	while ((current = (step_format_t *) list_next(i)) != NULL) {
2317
	current = (step_format_t *) list_next(i);
2318
	while (current != NULL) {
2308
		if (current->
2319
		if (current->
2309
		    function(job_step, current->width,
2320
		    function(job_step, current->width,
2310
			     current->right_justify, current->suffix)
2321
			     current->right_justify, current->suffix)
2311
		    != SLURM_SUCCESS)
2322
		    != SLURM_SUCCESS)
2312
			return SLURM_ERROR;
2323
		{
2324
			rc = SLURM_ERROR;
2325
			break;
2326
		}
2313
		if (current->width)
2327
		if (current->width)
2314
			total_width += current->width;
2328
			total_width += current->width;
2315
		else
2329
		else
2316
			total_width += 10;
2330
			total_width += 10;
2331
2332
		current = (step_format_t *) list_next(i);
2333
		if ( (params.field_delimiter != NULL) && (current != NULL) )
2334
			fputs(params.field_delimiter, stdout);
2317
	}
2335
	}
2318
	list_iterator_destroy(i);
2336
	list_iterator_destroy(i);
2319
	printf("\n");
2337
	printf("\n");
2320
2338
2321
	return SLURM_SUCCESS;
2339
	return rc;
2322
}
2340
}
2323
2341
2324
int
2342
int
(-)a/src/squeue/squeue.h (+3 lines)
Lines 103-108 struct squeue_parameters { Link Here
103
103
104
	uint32_t convert_flags;
104
	uint32_t convert_flags;
105
105
106
	char* field_delimiter;
107
	bool  should_show_parseable;
108
106
	List  account_list;
109
	List  account_list;
107
	List  format_list;
110
	List  format_list;
108
	List  job_list;
111
	List  job_list;

Return to ticket 5353