From df46b8050c89d7a87b70c86c2e2d6b69f96730fe Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Fri, 14 Aug 2009 23:18:55 +0000 Subject: [PATCH] make cancel of job step go to slurmctld rather than directly to slurmd so we can better log the event --- src/scancel/opt.c | 5 +++-- src/scancel/scancel.c | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/scancel/opt.c b/src/scancel/opt.c index c68049c2ea7..ae773b402d9 100644 --- a/src/scancel/opt.c +++ b/src/scancel/opt.c @@ -17,7 +17,7 @@ * any later version. * * In addition, as a special exception, the copyright holders give permission - * to link the code of portions of this program with the OpenSSL library under + * to link the code of portions of this program with the OpenSSL library unde * certain conditions as described in each individual source file, and * distribute linked combinations including the two. You must obey the GNU * General Public License in all respects for all of the code used other than @@ -352,7 +352,8 @@ static void _opt_args(int argc, char **argv) switch (opt_char) { case (int)'?': fprintf(stderr, - "Try \"scancel --help\" for more information\n"); + "Try \"scancel --help\" for more " + "information\n"); exit(1); break; case (int)'b': diff --git a/src/scancel/scancel.c b/src/scancel/scancel.c index b0bda4be811..6a77cd8780a 100644 --- a/src/scancel/scancel.c +++ b/src/scancel/scancel.c @@ -17,7 +17,7 @@ * any later version. * * In addition, as a special exception, the copyright holders give permission - * to link the code of portions of this program with the OpenSSL library under + * to link the code of portions of this program with the OpenSSL library under * certain conditions as described in each individual source file, and * distribute linked combinations including the two. You must obey the GNU * General Public License in all respects for all of the code used other than @@ -445,9 +445,12 @@ _cancel_step_id (void *ci) uint32_t job_id = cancel_info->job_id; uint32_t step_id = cancel_info->step_id; uint16_t sig = cancel_info->sig; + bool sig_set = true; - if (sig == (uint16_t)-1) + if (sig == (uint16_t)-1) { sig = SIGKILL; + sig_set = false; + } for (i=0; i<MAX_CANCEL_RETRY; i++) { if (sig == SIGKILL) @@ -457,7 +460,7 @@ _cancel_step_id (void *ci) sig, job_id, step_id); } - if (opt.ctld) + if ((!sig_set) || opt.ctld) error_code = slurm_kill_job_step(job_id, step_id, sig); else if (sig == SIGKILL) error_code = slurm_terminate_job_step(job_id, step_id); -- GitLab