ccancel - Cancel Jobs¶
ccancel terminates running or pending jobs in the queue.
You can cancel jobs by job ID or by using filter conditions to cancel multiple jobs at once.
Command Syntax¶
Command Line Options¶
Job Selection¶
- job_id[,job_id...]: Job ID(s) to cancel (comma-separated list). Format:
<job_id>or<job_id>,<job_id>,<job_id>...
Filter Options¶
- -n, --name string: Cancel jobs with the specified job name
- -u, --user string: Cancel jobs submitted by the specified user
- -A, --account string: Cancel jobs under the specified account
- -p, --partition string: Cancel jobs in the specified partition
- -t, --state string: Cancel jobs in the specified state. Valid states:
PENDING(P),RUNNING(R),ALL(case-insensitive) - -w, --nodes strings: Cancel jobs running on the specified nodes (comma-separated list)
Output Options¶
- --json: Output in JSON format
Miscellaneous¶
- -C, --config string: Configuration file path (default:
/etc/crane/config.yaml) - -h, --help: Display help information
- -v, --version: Display version number
Filter Rules¶
Important
At least one condition must be provided: either job ID(s) or at least one filter option.
When using multiple filters, jobs matching all specified conditions will be cancelled (AND logic).
Usage Examples¶
Cancel by Job ID¶
Cancel a single job:
Result:

Cancel multiple jobs:
Cancel by Job Name¶
Cancel all jobs named "test1":
Result:

Cancel by Partition¶
Cancel all jobs in GPU partition:
Result:

Cancel by Node¶
Cancel all jobs running on crane02:

Cancel by State¶
Cancel all pending jobs:

Cancel all running jobs:
Cancel all jobs (pending and running):
Cancel by Account¶
Cancel all jobs under PKU account:

Cancel by User¶
Cancel all jobs submitted by user ROOT:

Combined Filters¶
Cancel all pending jobs in CPU partition:
Cancel all jobs by user alice in GPU partition:
Cancel running jobs on specific nodes:
JSON Output¶
Get cancellation results in JSON format:
Cancel with filters and JSON output:
Examples Overview¶

Behavior After Cancellation¶
After a job is cancelled:
-
Process Termination: If there are no other jobs from the user on the allocated nodes, the job scheduling system will terminate all user processes on those nodes
-
SSH Access Revocation: SSH access to the allocated nodes will be revoked for the user
-
Resource Release: All allocated resources (CPUs, memory, GPUs) are immediately released and become available for other jobs
-
Job State Update: The job state changes to
CANCELLEDin the job history
Permission Requirements¶
- Regular Users: Can only cancel their own jobs
- Coordinators: Can cancel jobs within their account
- Operators/Admins: Can cancel any job in the system
Important Notes¶
-
Immediate Effect: Job cancellation takes effect immediately. Running jobs are terminated without grace period by default
-
Multiple Jobs: You can cancel multiple jobs at once using comma-separated job IDs or filter conditions
-
No Confirmation: There is no confirmation prompt. Jobs are cancelled immediately upon command execution
-
State Filtering: Use
-tto target specific job states to avoid accidentally cancelling jobs in unintended states -
Job ID Format: Job IDs must follow the format
<job_id>or<job_id>,<job_id>,<job_id>...with no spaces
Error Handling¶
Common errors:
- Invalid Job ID: Returns error if job ID doesn't exist or you don't have permission to cancel it
- No Matching Jobs: If filter conditions match no jobs, returns success with zero jobs cancelled
- Invalid State: State must be one of: PENDING, RUNNING, ALL (case-insensitive)