Torque: PBS job management cheat sheet

Tutorial

Job scheduling commands

CommandsFunctionBasic UsageExample
qsubsubmit a pbs jobqsub [script]$ qsub job.pbs
qdeldelete pbs batch jobqdel [job_id]$ qdel 123456
qholdhold pbs batch jobsqhold [job_id]$ qhold 123456
qrlsrelease hold on pbs batch jobsqrls [job_id]$ qrls 123456

Job management commands

Job StatusCommands
qstat -qlist all queues
qstat -alist all jobs
qstat -u useridlist jobs for userid
qstat -rlist running jobs
qstat -f job_idlist full information about job_id
qstat -Qf queuelist full information about queue
qstat -Blist summary status of the job server
pbsnodeslist status of all compute nodes

Job script basics

A typical job script will look like this:

#!/bin/bash
#PBS -l nodes=1:ppn=16
#PBS -l walltime=48:00:00
#PBS -N 
#PBS -o ${PBS_JOBNAME}.o${PBS_JOBID} 
#PBS -e ${PBS_JOBNAME}.e${PBS_JOBID}
#PBS -m ae -M $USER@iastate.edu
cd $PBS_O_WORKDIR
module use /data003/GIF/software/modules/
module load 
your_commands_goes_here

Lines starting with #PBS are for Torque resource manager to request resources for HPC. Some important options are as follows:

OptionExamplesDescription
-l#PBS -l nodes=1:ppn=16Number of nodes and processor per nodes
-l#PBS -l walltime=HH:MM:SSTotal time requested for your job
-q#PBS -q queue-nameQueue name (Note: this will be auto redirected depending or your reource request)
-o#PBS -o filenameSTDOUT to a file
-e#PBS -e filenameSTDERR to a file
-m a|b|e|n#PBS -m abeEmail notification: a=aborts, b=begins, e=ends
-m n#PBS -m nNo notifications
-M #PBS -M user@domain.eduEmail address to send notifications
-N#PBS -N jobnameProvide a useful jobname for your script

Interactive session

To start a interactive session you need to use the option -I, with all the other options you normally put in a PBS script file. For example:

qsub -I -N stdin -l nodes=1:ppn=16 -l walltime=1:00:00