Skip to content
Snippets Groups Projects
Commit b65ce7bd authored by Mark Grondona's avatar Mark Grondona
Browse files

o add -q,--quit-on-interrupt option to srun

parent 9a0f7aaf
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@ documents those changes that are of interest to users and admins.
-- Added job and node state descriptions to the squeue and sinfo man pages
-- Backup slurmctld to generate core file on SIGABRT
-- Backup slurmctld to re-read slurm.conf on SIGHUP
-- Added -q,--quit-on-interrupt option to srun.
* Changes in SLURM 0.3.0.0-pre6
===============================
......
......@@ -226,6 +226,12 @@ all remaining tasks. The default value is unlimited. This can be useful to
insure that a job is terminated in a timely fashion in the event that one
or more tasks terminate prematurely.
.TP
\fB\-q\fR, \fB\-\-quit-on-interrupt\fR
Quit immediately on single SIGINT (Ctrl-C). Use of this option
disables the status feature normally available when \fBsrun\fR receives
a single Ctrl-C and causes \fBsrun\fR to instead immediately terminate the
running job.
.TP
\fB\-\-uid\fR=\fIuser\fR
If
.B srun
......
......@@ -416,6 +416,8 @@ static void _opt_default()
opt.join = false;
opt.max_wait = slurm_get_wait_time();
opt.quit_on_intr = false;
_verbose = 0;
opt.slurmd_debug = LOG_LEVEL_QUIET;
......@@ -634,6 +636,7 @@ static void _opt_args(int argc, char **argv)
{"wait", required_argument, 0, 'W'},
{"exclude", required_argument, 0, 'x'},
{"no-allocate", no_argument, 0, 'Z'},
{"quit-on-interrupt", no_argument, 0, 'q'},
{"contiguous", no_argument, 0, LONG_OPT_CONT},
{"mincpus", required_argument, 0, LONG_OPT_MINCPU},
......@@ -650,7 +653,7 @@ static void _opt_args(int argc, char **argv)
{"usage", no_argument, 0, LONG_OPT_USAGE}
};
char *opt_string = "+a:Abc:C:d:D:e:Hi:IjJ:klm:n:N:"
"o:Op:r:st:T:uvVw:W:x:Z";
"o:Op:r:st:T:uvVw:W:x:Zq";
char **rest = NULL;
opt.progname = xbasename(argv[0]);
......@@ -769,6 +772,9 @@ static void _opt_args(int argc, char **argv)
xfree(opt.partition);
opt.partition = xstrdup(optarg);
break;
case (int)'q':
opt.quit_on_intr = true;
break;
case (int)'r':
xfree(opt.relative);
opt.relative = xstrdup(optarg);
......@@ -1319,6 +1325,7 @@ static void _help(void)
printf(" -T, --threads=threads set srun launch fanout\n");
printf(" -W, --wait=sec seconds to wait after first task ends\n");
printf(" before killing job\n");
printf(" -q, --quit-on-interrupt quit on single Ctrl-C\n");
printf("\nAllocate only:\n");
printf(" -A, --allocate allocate resources and spawn a shell\n");
......
......@@ -130,6 +130,7 @@ typedef struct srun_options {
bool no_kill; /* --no-kill, -k */
bool share; /* --share, -s */
int max_wait; /* --wait, -W */
bool quit_on_intr; /* --quit-on-interrupt, -q */
#ifdef HAVE_TOTALVIEW
bool totalview; /* srun controlled by TotalView */
#endif
......
......@@ -189,6 +189,10 @@ _sigterm_handler(int signum)
static void
_handle_intr(job_t *job, time_t *last_intr, time_t *last_intr_sent)
{
if (opt.quit_on_intr) {
job_force_termination(job);
pthread_exit (0);
}
if ((time(NULL) - *last_intr) > 1) {
info("interrupt (one more within 1 sec to abort)");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment