Managing Jobs
Exercises¶
- Submit a long job, then cancel it
Submit a job that sleeps for 1 hour. Confirm it is running or pending with squeue --me, then cancel it with scancel. Verify it is gone from the queue.
Hint / Solution
- Hold a pending job and release it
Submit a job in the held state using --hold. Verify its pending reason shows (JobHeldUser) in squeue. Then release it with scontrol release and confirm it returns to normal pending status.
Hint / Solution
- Modify a pending job's time limit
Submit a job with a 1-hour time limit in held state. Before releasing it, use scontrol update to change the time limit to 2 hours. Verify the change with scontrol show job, then release the job.
Hint / Solution
- Cancel only pending jobs
Submit three jobs: two short ones that will likely start running and one requesting large resources that will pend. Use scancel with --state=PENDING to cancel only the pending job while leaving the running ones alone.
Hint / Solution
sbatch --time=00:10:00 --wrap="sleep 300" --job-name=runner1
sbatch --time=00:10:00 --wrap="sleep 300" --job-name=runner2
sbatch --time=00:10:00 --mem=500G --wrap="sleep 60" --job-name=will_pend
squeue --me
scancel --me --state=PENDING
squeue --me
# Running jobs should still be there; pending job should be gone
# Clean up
scancel --me