Managing and Canceling Jobs
Last updated on 2026-08-24 | Edit this page
Estimated time: 20 minutes
Overview
Questions
- How do I cancel a running or queued job?
- What do I do when a job is stuck pending?
- How do I troubleshoot common job failures?
Objectives
- Use
scancelto cancel jobs safely - Diagnose why jobs are stuck in PENDING state
- Troubleshoot timeout, out-of-memory, and other common failures
Canceling Jobs with scancel
Cancel Multiple Jobs
BASH
# Cancel all your jobs
scancel -u $USER
# Cancel by name
scancel --name=test
# Cancel only pending jobs
scancel --state=PENDING -u $USER
# Cancel by partition
scancel -u $USER --partition=amd
Be Careful with scancel
Cancellation is immediate and irreversible. Before canceling: 1.
Verify the job ID: squeue -j 12345 2. Consider if partial
results should be saved 3. Never use scancel -u $USER
unless you intend to cancel everything
A safer approach:
Troubleshooting: Job Stuck in PENDING
Check the reason:
| Reason | Meaning | Solution |
|---|---|---|
| Resources | No suitable node available | Reduce resource requests or wait |
| QOSMaxPerUser | Hit quota | Wait for other jobs to finish |
| ReqNodeNotAvail | Requested node is down | Remove -w flag; let SLURM choose |
Troubleshooting: Job Failures
“Module not found”
Ensure your shebang has the -l flag:
Or explicitly source the module environment:
Challenge 1: Cancel Practice
After canceling, squeue no longer shows the job.
sacct shows STATE=CANCELLED with exit code 0:0, because
cancellation is not a failure – the job simply did not run to
completion.
- Use
scancel JOBIDto cancel a specific job;scancel -u $USERcancels all your jobs - Always verify the job ID before canceling
- Pending jobs: check reason with
squeue -O reason - Timeout: increase
--time; OOM: increase--mem - Script errors show as FAILED with non-zero exit code; check output files
- Ensure
#!/bin/bash -lso modules load correctly in batch scripts