.SH "DESCRIPTION"
\fBscancel\fR is used to signal or cancel jobs, job arrays or job steps.
An arbitrary number of jobs or job steps may be signaled using job
specification filters or a space separated list of specific job and/or
job step IDs.
If the job ID of a job array is specified with an array ID value then only that
job array element will be cancelled.
If the job ID of a job array is specified without an array ID value then all
job array elements will be cancelled.
While a heterogeneous job is in pending state, only the entire job can be
cancelled rather than its individual components.
A request to cancel an individual component of a heterogeneous job not in
pending state will return an error.
After the job has begun execution, the individual component can be cancelled.
A job or job step can only be signaled by the owner of that job or user root.
If an attempt is made by an unauthorized user to signal a job or job step, an
error message will be printed and the job will not be signaled.

.SH "OPTIONS"

.TP
\fB\-A\fR, \fB\-\-account\fR=\fIaccount\fR
Restrict the scancel operation to jobs under this charge account.

.TP
\fB\-b\fR, \fB\-\-batch\fR
By default, signals other than SIGKILL are not sent to the batch step (the shell
script). With this option \fBscancel\fR signals only the batch step, but not
any other steps.
This is useful when the shell script has to trap the signal and take some
application defined action.
Note that most shells cannot handle signals while a command is running (child
process of the batch step), the shell use to wait until the command ends to
then handle the signal. Children of the batch step are not signaled with this
option, use \fB\-f\fR, \fB\-\-full\fR instead.
NOTE: If used with \fB\-f\fR, \fB\-\-full\fR, this option ignored.
NOTE: This option is not applicable if \fIstep_id\fR is specified.
NOTE: The shell itself may exit upon receipt of many signals.
You may avoid this by explicitly trap signals within the shell
script (e.g. "trap <arg> <signals>"). See the shell documentation
for details.

.TP
\fB\-\-ctld\fR
Send the job signal request to the slurmctld daemon rather than directly to the
slurmd daemons. This increases overhead, but offers better fault tolerance.
This is the default behavior on architectures using front end nodes (e.g.
Cray ALPS computers) or when the \fB\-\-clusters\fR option is used.

.TP
\fB\-f\fR, \fB\-\-full\fR
.TP
\fB\-H\fR, \fB\-\-hurry\fR
Do not stage out any burst buffer data.

.TP
\fB\-i\fR, \fB\-\-interactive\fR
Interactive mode. Confirm each job_id.step_id before performing the cancel operation.

.TP
\fB\-M\fR, \fB\-\-clusters\fR=<\fIstring\fR>
Cluster to issue commands to. Implies \fB\-\-ctld\fR.
Note that the SlurmDBD must be up for this option to work properly.

.TP
\fB\-n\fR, \fB\-\-jobname\fR=\fIjob_name\fR, \fB\-\-name\fR=\fIjob_name\fR
Restrict the scancel operation to jobs with this job name.

.TP
\fB\-p\fR, \fB\-\-partition\fR=\fIpartition_name\fR
Restrict the scancel operation to jobs in this partition.

.TP
\fB\-q\fR, \fB\-\-qos\fR=\fIqos\fR
Restrict the scancel operation to jobs with this quality of service.

.TP
\fB\-Q\fR, \fB\-\-quiet\fR
Do not report an error if the specified job is already completed.
This option is incompatible with the \fB\-\-verbose\fR option.


.TP
\fB\-R\fR, \fB\-\-reservation\fR=\fIreservation_name\fR
Restrict the scancel operation to jobs with this reservation name.

.TP
\fB\-\-sibling\fR=\fIcluster_name\fR
Remove an active sibling job from a federated job.

.TP
\fB\-s\fR, \fB\-\-signal\fR=\fIsignal_name\fR
The name or number of the signal to send.  If this option is not used
the specified job or step will be terminated. \fBNote\fR. If this option
is used the signal is sent directly to the slurmd where the job is
running bypassing the slurmctld thus the job state will not change even
if the signal is delivered to it. Use the \fIscontrol\fR command if
you want the job state change be known to slurmctld.

.TP
\fB\-t\fR, \fB\-\-state\fR=\fIjob_state_name\fR
Restrict the scancel operation to jobs in this
state. \fIjob_state_name\fR may have a value of either "PENDING",

.TP
\fB\-V\fR, \fB\-\-version\fR
Print the version number of the scancel command.

.TP
\fB\-w\fR, \fB\-\-nodelist=\fIhost1,host2,...\fR
Cancel any jobs using any of the given hosts.  The list may be specified as
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

.TP
\fIjob_id\fP
The Slurm job ID to be signaled.

.TP
\fIstep_id\fP
The step ID of the job step to be signaled.
If not specified, the operation is performed at the level of a job.

If neither \fB\-\-batch\fR nor \fB\-\-signal\fR are used,
the entire job will be terminated.

When \fB\-\-batch\fR is used, the batch shell processes will be signaled.
The child processes of the shell will not be signaled by Slurm, but
the shell may forward the signal.

When \fB\-\-batch\fR is not used but \fB\-\-signal\fR is used,
then all job steps will be signaled, but the batch script itself
will not be signaled.

.SH "PERFORMANCE"
.PP
Executing \fBscancel\fR sends a remote procedure call to \fBslurmctld\fR. If
enough calls from \fBscancel\fR or other Slurm client commands that send remote
procedure calls to the \fBslurmctld\fR daemon come in at once, it can result in
a degradation of performance of the \fBslurmctld\fR daemon, possibly resulting
in a denial of service.
.PP
Do not run \fBscancel\fR or other Slurm client commands that send remote
procedure calls to \fBslurmctld\fR from loops in shell scripts or other
programs. Ensure that programs limit calls to \fBscancel\fR to the minimum
necessary for the information you are trying to gather.
\fB\-\-ctld\fR
.TP
\fBSCANCEL_FULL\fR
\fB\-f, \-\-full\fR
.TP
\fBSCANCEL_HURRY\fR
\fB\-H\fR, \fB\-\-hurry\fR
.TP
\fBSCANCEL_INTERACTIVE\fR
\fB\-i\fR, \fB\-\-interactive\fR
.TP
\fBSCANCEL_NAME\fR
\fB\-n\fR, \fB\-\-name\fR=\fIjob_name\fR
.TP
\fBSCANCEL_PARTITION\fR
\fB\-p\fR, \fB\-\-partition\fR=\fIpartition_name\fR
.TP
\fBSCANCEL_QOS\fR
\fB\-q\fR, \fB\-\-qos\fR=\fIqos\fR
.TP
\fBSCANCEL_STATE\fR
\fB\-t\fR, \fB\-\-state\fR=\fIjob_state_name\fR
.TP
\fBSCANCEL_USER\fR
\fB\-u\fR, \fB\-\-user\fR=\fIuser_name\fR
.TP
\fBSCANCEL_VERBOSE\fR
\fB\-v\fR, \fB\-\-verbose\fR
.TP
\fBSCANCEL_WCKEY\fR
\fB\-\-wckey\fR=\fIwckey\fR
.TP
\fBSLURM_CONF\fR
The location of the Slurm configuration file.
.TP
\fBSLURM_CLUSTERS\fR
\fB\-M\fR, \fB\-\-clusters\fR

.SH "NOTES"
.LP
If multiple filters are supplied (e.g. \fB\-\-partition\fR and \fB\-\-name\fR)
only the jobs satisfying all of the filtering options will be signaled.
.LP
Cancelling a job step will not result in the job being terminated.
The job must be cancelled to release a resource allocation.
.LP
To cancel a job, invoke \fBscancel\fR without \-\-signal option.  This
will send first a SIGCONT to all steps to eventually wake them up followed by
a SIGTERM, then wait the KillWait duration defined in the slurm.conf file
and finally if they have not terminated send a SIGKILL.  This gives
time for the running job/step(s) to clean up.
.LP

.SH "EXAMPLES"
.TP
Send SIGTERM to steps 1 and 3 of job 1234:
scancel \-\-signal=TERM 1234.1 1234.3

.TP
Cancel job 1234 along with all of its steps:
scancel 1234

.TP
Send SIGKILL to all steps of job 1235, but do not cancel the job itself:
scancel \-\-signal=KILL 1235

.TP
Send SIGUSR1 to the batch shell processes of job 1236:
scancel \-\-signal=USR1 \-\-batch 1236

.TP
Cancel job all pending jobs belonging to user "bob" in partition "debug":
scancel \-\-state=PENDING \-\-user=bob \-\-partition=debug

.TP
Cancel only array ID 4 of job array 1237
scancel 1237_4

.SH "COPYING"
Copyright (C) 2002-2007 The Regents of the University of California.
Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
.br
Copyright (C) 2008-2011 Lawrence Livermore National Security.
.br
Copyright (C) 2010\-2015 SchedMD LLC.
.LP
This file is part of Slurm, a resource management program.
For details, see <https://slurm.schedmd.com/>.
.LP
Slurm is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
.LP
Slurm is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
details.

.SH "SEE ALSO"
\fBslurm_kill_job\fR (3), \fBslurm_kill_job_step\fR (3)