diff --git a/doc/man/man1/scancel.1 b/doc/man/man1/scancel.1 index ded779e8398990a4b5da28c4bf8a32cd1d8fe8cc..df8244cd0bdcb77ec88f30a5e25bffc46ba014a7 100644 --- a/doc/man/man1/scancel.1 +++ b/doc/man/man1/scancel.1 @@ -84,7 +84,7 @@ Print additional logging. Multiple v's increase logging detail. This option is incompatible with the \fB\-\-quiet\fR option. .TP -\fB\-V\fR, \fB\-\-Version\fR +\fB\-V\fR, \fB\-\-version\fR Print the version number of the scancel command. .TP @@ -94,6 +94,11 @@ a comma\-separated list of hosts, a range of hosts (host[1\-5,7,...] for example), or a filename. The host list will be assumed to be a filename only if it contains a "/" character. +.TP +\fB\-\-wckey\fR=\fIwckey\fR +Restrict the scancel operation to jobs using this workload +characterization key. + .TP ARGUMENTS @@ -153,6 +158,9 @@ environment variables, along with their corresponding options, are listed below. \fBSCANCEL_VERBOSE\fR \fB\-v\fR, \fB\-\-verbose\fR .TP 20 +\fBSCANCEL_WCKEY\fR +\fB\-\-wckey\fR=\fIwckey\fR +.TP 20 \fBSLURM_CONF\fR The location of the SLURM configuration file. diff --git a/src/scancel/scancel.c b/src/scancel/scancel.c index b7946f8e2b598cfae0e12dd8418bcedfa03d8d55..cda426b8463e5d78f1dd41d879bd72de9484296b 100644 --- a/src/scancel/scancel.c +++ b/src/scancel/scancel.c @@ -116,7 +116,8 @@ main (int argc, char *argv[]) (opt.partition) || (opt.qos) || (opt.state != JOB_END) || - (opt.user_name)) { + (opt.user_name) || + (opt.wckey)) { _filter_job_records (); } _cancel_jobs (); @@ -248,6 +249,24 @@ _filter_job_records (void) } } + if (opt.wckey != NULL) { + char *job_key = job_ptr[i].wckey; + + /* + * A wckey that begins with '*' indicates that the wckey + * was applied by default. When the --wckey option does + * not begin with a '*', act on all wckeys with the same + * name, default or not. + */ + if ((opt.wckey[0] != '*') && (job_key[0] == '*')) + job_key++; + + if (strcmp(job_key, job_ptr[i].wckey) != 0) { + job_ptr[i].job_id = 0; + continue; + } + } + if (opt.job_cnt == 0) continue; for (j = 0; j < opt.job_cnt; j++) {