Batch Command-line Tools

User Environment

The SGE commands should be automatically available to all users of the system. It is therefore not usually necessary to make any changes to your user environment. However if you try to run qsub or qstat you may receive an error:

bash: qsub: command not found

To fix this you need to load the batch system modulefile on the login node using:

module load services/gridscheduler

You will then be able to submit jobs, monitor your jobs and so on.

Batch Commands

You codes and applications should be run in the batch system. You’ll need a jobscript describing your job, which will either be a serial job or a parallel job.

You’ll then use one or more of the following batch system commands to submit your job to the system and check on its status. These commands should be run from the system’s login node:

qsub jobscript
Submit a job to the batch system. The most common use case is to submit a jobscript (which contains all of the required settings). Alternatively you can specify job options on the qsub command-line. Most of the examples in our documentation opt for the jobscript because this allows you to easily reuse your jobscript every time you want to run the job. Remembering the command-line options you used (possibly months ago) is much more difficult.
qstat
Report the current status of your jobs in the batch system (queued/waiting, running, in error, finished).
qdel jobid
To remove your job from the batch system (either terminate a running job before it finishes or simply remove a queued job from the queue). Use this if your job goes in to an error state or you decide you don’t want a job to run. For example maybe you realise you’ve given it the wrong input parameters causing it to produce junk results. You don’t need to leave it running to completion (which might be hours or days). Instead you can kill the job using qdel.
qalter options
Advanced users. It may be possible to modify a job that is waiting in the queue (e.g., if you forgot to request a high-memory node you could add that option without deleting the job and resubmitting it).
qacct -j jobid
Advanced users. Once your job has finished you can use this command to get a summary of information for wall-clock time, cpu-time, and system time.

Further Information

Our own documentation throughout this site provides lots of examples of writing jobscripts and how to submit jobs. SGE also comes with a set of comprehensive man pages. Some of the most useful ones are:

  • man qsub
  • man qstat
  • man qdel
  • man qacct

Last modified on August 4, 2016 at 9:00 am by Site Admin