|
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\ |