Skip to content

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

ccancel [job_id[,job_id...]] [OPTIONS]

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:

ccancel 30686

Result:

ccancel ccancel ccancel

Cancel multiple jobs:

ccancel 30686,30687,30688

Cancel by Job Name

Cancel all jobs named "test1":

ccancel -n test1

Result:

ccancel ccancel ccancel

Cancel by Partition

Cancel all jobs in GPU partition:

ccancel -p GPU

Result:

ccancel ccancel ccancel

Cancel by Node

Cancel all jobs running on crane02:

ccancel -w crane02

ccancel

Cancel by State

Cancel all pending jobs:

ccancel -t Pending

ccancel

Cancel all running jobs:

ccancel -t Running

Cancel all jobs (pending and running):

ccancel -t All

Cancel by Account

Cancel all jobs under PKU account:

ccancel -A PKU

ccancel

Cancel by User

Cancel all jobs submitted by user ROOT:

ccancel -u ROOT

ccancel

Combined Filters

Cancel all pending jobs in CPU partition:

ccancel -t Pending -p CPU

Cancel all jobs by user alice in GPU partition:

ccancel -u alice -p GPU

Cancel running jobs on specific nodes:

ccancel -t Running -w crane01,crane02

JSON Output

Get cancellation results in JSON format:

ccancel 30686 --json

Cancel with filters and JSON output:

ccancel -p GPU -t Pending --json

Examples Overview

ccancel

Behavior After Cancellation

After a job is cancelled:

  1. 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

  2. SSH Access Revocation: SSH access to the allocated nodes will be revoked for the user

  3. Resource Release: All allocated resources (CPUs, memory, GPUs) are immediately released and become available for other jobs

  4. Job State Update: The job state changes to CANCELLED in 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

  1. Immediate Effect: Job cancellation takes effect immediately. Running jobs are terminated without grace period by default

  2. Multiple Jobs: You can cancel multiple jobs at once using comma-separated job IDs or filter conditions

  3. No Confirmation: There is no confirmation prompt. Jobs are cancelled immediately upon command execution

  4. State Filtering: Use -t to target specific job states to avoid accidentally cancelling jobs in unintended states

  5. 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)

See Also

  • cbatch - Submit batch jobs
  • crun - Run interactive tasks
  • calloc - Allocate interactive resources
  • cqueue - View job queue
  • cacct - View job accounting information
  • ccontrol - Control jobs and system resources