diff --git a/NEWS b/NEWS index 05a9e7c0ee448cf6cf806e342a50528b0fe4c426..d9af9a17cf9ce1af54bf73cedd11f6e5a20d7457 100644 --- a/NEWS +++ b/NEWS @@ -69,6 +69,7 @@ documents those changes that are of interest to users and administrators. -- Allow priority/multifactor to work with sched/wiki(2) if all priorities have no weight. This allows for association and QOS decay limits to work. -- Fix "squeue --start" to override SQUEUE_FORMAT env variable. + -- Fix scancel to be able to cancel multiple jobs that are space delimited. * Changes in Slurm 14.11.1 ========================== diff --git a/src/scancel/opt.c b/src/scancel/opt.c index 4a29a5891fbed6d8df374d3709c84c3043b13564..a5f858738c13aaa962855fc0ca4a8ad6a1c6b4da 100644 --- a/src/scancel/opt.c +++ b/src/scancel/opt.c @@ -457,7 +457,7 @@ static void _opt_args(int argc, char **argv) if (optind < argc) { char **rest = argv + optind; - opt.job_list = xstrdup(*rest); + opt.job_list = rest; _xlate_job_step_ids(rest); } diff --git a/src/scancel/scancel.c b/src/scancel/scancel.c index 9e73b3be5ce3ed62ba1c339ea4207597fb057d9f..7909b44dd07cb14776887b674539b203033e9b86 100644 --- a/src/scancel/scancel.c +++ b/src/scancel/scancel.c @@ -737,17 +737,20 @@ _confirmation (int i, uint32_t step_id) static int _signal_job_by_str(void) { - int cc; + int cc, i; + int rc = 0; if (opt.signal == (uint16_t) - 1) opt.signal = SIGKILL; - verbose("Terminating job %s", opt.job_list); + for (i = 0; opt.job_list[i]; i++) { + verbose("Terminating job %s", opt.job_list[i]); - cc = slurm_kill_job2(opt.job_list, opt.signal, 0); - if ((cc != SLURM_SUCCESS) && (opt.verbose != -1)) { - error("slurm_kill_job2() failed %s", slurm_strerror(errno)); - return -1; + cc = slurm_kill_job2(opt.job_list[i], opt.signal, 0); + if ((cc != SLURM_SUCCESS) && (opt.verbose != -1)) { + error("slurm_kill_job2() failed %s", slurm_strerror(errno)); + rc = -1; + } } - return 0; + return rc; } diff --git a/src/scancel/scancel.h b/src/scancel/scancel.h index 82e925940d19b7e59a54e8075666fea5744c1b1f..e2f8883ca9f26a1da2ac4d275348392ae2196c2c 100644 --- a/src/scancel/scancel.h +++ b/src/scancel/scancel.h @@ -67,7 +67,7 @@ typedef struct scancel_options { uint32_t *step_id; /* list of job step id's */ char *wckey; /* --wckey */ char *nodelist; /* --nodelist, -w */ - char *job_list; /* list of job ids as char * */ + char **job_list; /* list of job ids as char * */ } opt_t; opt_t opt;