jacked.in

Moab / Torque Primer Part 1: Submitting Jobs

Traditionally, the most common way of submitting jobs to a cluster is from the command-line or a shell script by using the qsub command. qsub is part of Torque and submits jobs into Torque’s job queue. When Torque and Moab are used in combination, then Moab receives the information about the job through Torque automatically which is typically completely oblivious to the user.

For the user to control various properties of the job and have control over what the job does, qsub takes a so-called submission script as input. The submission script is typically a normal shell script written by the user that describes which commands should be executed once the job gets to run. The submission script can be passed to qsub either through standard input or as a file specified as a command-line argument:

$ cat << EOF > test_job.sh
sleep 60
hostname
EOF
$ qsub test_job.sh

is equivalent to:

$ echo "sleep 60 ; hostname" | qsub

In either case, Torque makes an internal copy of the script and uses this copy to actually run the job. In most cases the user would write the submission script as a file as such scripts are typically rather complex.

In addition to the submission script qsub also accepts arguments that specify certain properties about the job, such as the job’s name, its expected runtime, the priority or into which queue it should be submitted. Those properties can either be specified as command-line arguments to the qsub command or specified within the job’s submission script using a special syntax. For example, to submit a job with name “testjob”, the name of the job can either be specified as a command-line argument:

$ cat << EOF | qsub -N testjob
sleep 60
hostname
EOF

or as part of the submission script:

$ cat << EOF | qsub
#PBS -N testjob
sleep 60
hostname
EOF

Note, the #PBS directive in the submission script. It instructs Torque to interpret the following parameters as if they where specified on the command-line.

Please see the qsub manpage for information on other command-line arguments and additional information.

Comments

comments powered by Disqus