Here is a patch against 2.4 that changes the "squeue -n <hostlist>" option to
"squeue -w <hostlist>" to match sacncel's convention. This freed up the
"squeue -n" option to serve as the short form alternative to the new "squeue
--name" option announced below.
The old, deprecated squeue -n <hostlist> behavior can be revived using a new
configure --enable-old-squeue-n-option=yes option. No changes were needed to
test5.6.
(autogen.sh will need to be re-run.)
Don
diff --git a/configure.ac b/configure.ac
index 47674a3..c11418e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -342,6 +342,18 @@ else
AC_MSG_RESULT([no])
fi
+dnl
+dnl Reverts the squeue -n option to its old, deprecated behavior
+dnl
+AC_MSG_CHECKING([whether to support the deprecated squeue -n hostlist option])
+AC_ARG_ENABLE([old-squeue-n-option],
+ AS_HELP_STRING(--enable-old-squeue-n-option,enable the deprecated squeue -n
hostlist option),
+ [ac_old_squeue_n_option=${enableval}], [ac_old_squeue_n_option=no])
+AC_MSG_RESULT([${ac_old_squeue_n_option}])
+if test "x${ac_old_squeue_n_option}" = "xyes"; then
+ AC_DEFINE(OLD_SQUEUE_N_OPTION, 1, [Enable deprecated squeue -n hostlist
option])
+fi
+
AUTHD_LIBS="-lauth -le"
savedLIBS="$LIBS"
diff --git a/doc/man/man1/squeue.1 b/doc/man/man1/squeue.1
index 904b260..9763c52 100644
--- a/doc/man/man1/squeue.1
+++ b/doc/man/man1/squeue.1
@@ -62,11 +62,9 @@ Clusters to issue commands to. Multiple cluster names may
be comma separated.
A value of of '\fIall\fR' will query to run on all clusters.
.TP
-\fB\-n <hostlist>\fR, \fB\-\-nodes=<hostlist>\fR
-Report only on jobs allocated to the specified node or list of nodes.
-This may either be the \fBNodeName\fR or \fBNodeHostname\fR
-as defined in \fBslurm.conf(5)\fR in the event that they differ.
-A node_name of \fBlocalhost\fR is mapped to the current host name.
+\fB\-n\fR, \fB\-\-name\fR=\fIjob_name\fR
+Request jobs or job steps having one of the specified names. The
+list consists of a comma separated list of job names.
.TP
\fB\-o <output_format>\fR, \fB\-\-format=<output_format>\fR
@@ -404,11 +402,6 @@ Request jobs or job steps from a comma separated list of
users. The
list can consist of user names or user id numbers.
.TP
-\fB\-\-name=<name_list>\fR
-Request jobs or job steps having one of the specified names. The
-list consists of a comma separated list of job names.
-
-.TP
\fB\-\-usage\fR
Print a brief help message listing the \fBsqueue\fR options.
@@ -420,6 +413,13 @@ Report details of squeues actions.
\fB\-V\fR , \fB\-\-version\fR
Print version information and exit.
+.TP
+\fB\-w\fR, \fB\-\-nodelist=\fIhost1,host2,...\fR
+Report only on jobs allocated to the specified node or list of nodes.
+This may either be the \fBNodeName\fR or \fBNodeHostname\fR
+as defined in \fBslurm.conf(5)\fR in the event that they differ.
+A node_name of \fBlocalhost\fR is mapped to the current host name.
+
.SH "JOB REASON CODES"
These codes identify the reason that a job is waiting for execution.
A job may be waiting for more than one reason, in which case only
diff --git a/src/squeue/opts.c b/src/squeue/opts.c
index 9ee7e8b..5bc4911 100644
--- a/src/squeue/opts.c
+++ b/src/squeue/opts.c
@@ -108,9 +108,16 @@ parse_command_line( int argc, char* argv[] )
{"long", no_argument, 0, 'l'},
{"cluster", required_argument, 0, 'M'},
{"clusters", required_argument, 0, 'M'},
+#ifdef OLD_SQUEUE_N_OPTION
{"name", required_argument, 0, OPT_LONG_NAME},
{"node", required_argument, 0, 'n'},
{"nodes", required_argument, 0, 'n'},
+#else
+ {"name", required_argument, 0, 'n'},
+ {"node", required_argument, 0, 'w'},
+ {"nodes", required_argument, 0, 'w'},
+#endif
+ {"nodelist", required_argument, 0, 'w'},
{"noheader", no_argument, 0, 'h'},
{"partitions", required_argument, 0, 'p'},
{"qos", required_argument, 0, 'q'},
@@ -144,7 +151,7 @@ parse_command_line( int argc, char* argv[] )
}
while ((opt_char = getopt_long(argc, argv,
- "A:ahi:j::ln:M:o:p:q:R:s::S:t:u:U:vV",
+ "A:ahi:j::ln:M:o:p:q:R:s::S:t:u:U:vVw:",
long_options, &option_index)) != -1) {
switch (opt_char) {
case (int)'?':
@@ -197,6 +204,7 @@ parse_command_line( int argc, char* argv[] )
}
working_cluster_rec = list_peek(params.clusters);
break;
+#ifdef OLD_SQUEUE_N_OPTION
case (int) 'n':
if (params.nodes)
hostset_destroy(params.nodes);
@@ -208,6 +216,18 @@ parse_command_line( int argc, char* argv[] )
exit(1);
}
break;
+ case OPT_LONG_NAME:
+ xfree(params.names);
+ params.names = xstrdup(optarg);
+ params.name_list = _build_str_list( params.names );
+ break;
+#else
+ case (int) 'n':
+ xfree(params.names);
+ params.names = xstrdup(optarg);
+ params.name_list = _build_str_list( params.names );
+ break;
+#endif
case (int) 'o':
xfree(params.format);
params.format = xstrdup(optarg);
@@ -262,17 +282,23 @@ parse_command_line( int argc, char* argv[] )
case (int) 'V':
print_slurm_version();
exit(0);
+ case (int) 'w':
+ if (params.nodes)
+ hostset_destroy(params.nodes);
+
+ params.nodes = hostset_create(optarg);
+ if (params.nodes == NULL) {
+ error("'%s' invalid entry for --nodelist",
+ optarg);
+ exit(1);
+ }
+ break;
case OPT_LONG_HELP:
_help();
exit(0);
case OPT_LONG_HIDE:
params.all_flag = false;
break;
- case OPT_LONG_NAME:
- xfree(params.names);
- params.names = xstrdup(optarg);
- params.name_list = _build_str_list( params.names );
- break;
case OPT_LONG_START:
params.start_flag = true;
break;
@@ -351,6 +377,12 @@ parse_command_line( int argc, char* argv[] )
params.account_list = _build_str_list( params.accounts );
}
+ if ( ( params.names == NULL ) &&
+ ( env_val = getenv("SQUEUE_NAMES") ) ) {
+ params.names = xstrdup(env_val);
+ params.name_list = _build_str_list( params.names );
+ }
+
if ( ( params.partitions == NULL ) &&
( env_val = getenv("SQUEUE_PARTITION") ) ) {
params.partitions = xstrdup(env_val);
@@ -376,12 +408,6 @@ parse_command_line( int argc, char* argv[] )
params.user_list = _build_user_list( params.users );
}
- if ( ( params.names == NULL ) &&
- ( env_val = getenv("SQUEUE_NAMES") ) ) {
- params.names = xstrdup(env_val);
- params.name_list = _build_str_list( params.names );
- }
-
if ( params.start_flag && !params.step_flag ) {
/* Set more defaults */
if (params.format == NULL)
@@ -1144,7 +1170,7 @@ static void _usage(void)
{
printf("\
Usage: squeue [-i seconds] [-S fields] [--start] [-t states]\n\
- [-p partitions] [-n node] [-o format] [-u user_name]\n\
+ [-p partitions] [-w node] [-o format] [-u user_name]\n\
[-R reservation] [--usage] [-ahjlsv]\n");
}
@@ -1163,9 +1189,18 @@ Usage: squeue [OPTIONS]\n\
-l, --long long report\n\
-M, --clusters=cluster_name cluster to issue commands to. Default is\n\
current cluster. cluster with no name
will\n\
- reset to default.\n\
+ reset to default.\n");
+#ifdef OLD_SQUEUE_N_OPTION
+ printf("\
+ --name=job_name(s) comma separated list of job names to view\n\
+Note, the following option is deprecated. Instead, use -w, --nodelist=\n\
-n, --nodes=hostlist list of nodes to view, default is \n\
- all nodes\n\
+ all nodes\n");
+#else
+ printf("\
+ -n, --name=job_name(s) comma separated list of job names to
view\n");
+#endif
+ printf("\
-o, --format=format format specification\n\
-p, --partition=partition(s) comma separated list of partitions\n\
to view, default is all partitions\n\
@@ -1180,9 +1215,10 @@ Usage: squeue [OPTIONS]\n\
default is pending and running,\n\
'--states=all' reports all states\n\
-u, --user=user_name(s) comma separated list of users to view\n\
- --name=job_name(s) comma separated list of job names to view\n\
-v, --verbose verbosity level\n\
-V, --version output version information and exit\n\
+ -w, --nodelist=node(s) list of nodes to view jobs, default is \n\
+ all nodes\n\
\nHelp options:\n\
--help show this help message\n\
--usage display a brief summary of squeue
options\n");
diff --git a/src/squeue/squeue.h b/src/squeue/squeue.h
index ffd45e0..1df5449 100644
--- a/src/squeue/squeue.h
+++ b/src/squeue/squeue.h
@@ -92,6 +92,7 @@ struct squeue_parameters {
uint32_t cluster_flags;
char* format;
char* jobs;
+ char* names;
hostset_t nodes;
char* partitions;
char* qoss;
@@ -100,7 +101,6 @@ struct squeue_parameters {
char* states;
char* steps;
char* users;
- char* names;
List account_list;
List format_list;
> -----Original Message-----
> From: [email protected] [mailto:owner-slurm-
> [email protected]] On Behalf Of Yuri D'Elia
> Sent: Monday, November 21, 2011 4:09 AM
> To: [email protected]
> Subject: [slurm-dev] Select jobs by name in squeue [patch]
>
> Hi everyone.
>
> I'm using job names as a simple way to group job batches. "scancel"
> already allows to kill by name, so it made sense to implement job
> selection by name in squeue too, in order to restrict the view to a
> particular batch.
>
> "-n" was already taken in squeue (sadly, since most other commands use
> 'w' for the node list), so I only added the long "--name" option to
> mimic scancel's usage.
>
> Diffed against 2.4.0-0.pre1.
>
> Bests.