Using the MOAB Workload Manager - Basic MOAB Script
Article Index
Using the MOAB Workload Manager
Basic MOAB Script
MOAB Serial Job
Running an interactive job
Running an MPI job
MOAB MPICH2 Job
MOAB OpenMPI Job
MOAB MPICH1 Job
Job Dependencies
MOAB Queues
All Pages

Example 1:Basic MOAB Script

This job shows a basic example of running a simple job in MOAB and some of the useful variables available to users from PBS. Below is an example MOAB script. In this example, this script is saved as moab.ex1.

#!/bin/bash

#MOAB -N moab_ex1

echo ------------------------------------------------------
echo -n 'Job is running on node '; cat $PBS_NODEFILE
echo ------------------------------------------------------
echo MOAB: qsub is running on $PBS_O_HOST
echo MOAB: originating queue is $PBS_O_QUEUE
echo MOAB: executing queue is $PBS_QUEUE
echo MOAB: working directory is $PBS_O_WORKDIR
echo MOAB: execution mode is $PBS_ENVIRONMENT
echo MOAB: job identifier is $PBS_JOBID
echo MOAB: job name is $PBS_JOBNAME
echo MOAB: node file is $PBS_NODEFILE
echo MOAB: current home directory is $PBS_O_HOME
echo MOAB: PATH = $PBS_O_PATH
echo ----------------------------------------------
echo ------------------------------------------------------
echo -n 'Job is running on node '; cat $PBS_NODEFILE
echo ------------------------------------------------------
echo ' '
echo ' '

The directive #MOAB -N moab_ex1 names the job for moab and will consequently name the standard output and standard error to the files moab_ex1.o and moab_ex1.e. To join the standard output and the standard error to a single file moab_ex1.o add the directive:#MOAB -j oe. If the name is not specified, the default is for the batch system to create two files, one for standard output and one for standard error named STDIN.o and STDIN.e. The remaining variables are self-explanatory. Below is the output from running this script (saved in a file as moab.ex2) in a users home directory:

[jmcdon@scs ~]$ msub moab.ex1

1158
$ cat moab_ex1.o1157
------------------------------------------------------
Job is running on node hpc-3-1.local
------------------------------------------------------
MOAB: qsub is running on admin.hpc.fsu.edu
MOAB: originating queue is default
MOAB: executing queue is default
MOAB: working directory is /home/jmcdon
MOAB: execution mode is PBS_BATCH
MOAB: job identifier is 1157.admin.hpc.fsu.edu
MOAB: job name is moab_ex1
MOAB: node file is /opt/torque/aux//1157.admin.hpc.fsu.edu
MOAB: current home directory is /home/jmcdon
MOAB: PATH = /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
----------------------------------------------
------------------------------------------------------
Job is running on node hpc-3-1.local
------------------------------------------------------

Moab parameters

There are several moab parameters that you can use in the preamble of your script or as a parameter to msub. If you give them in your script, you have to start the line with "#MOAB", for example "#MOAB -N name". A few useful options are:

OptionMeaning
-N name Declares the name of your job to "name" (and outputfiles).
-l nodes=n Requests n nodes for this job
-j oe Have the standard output and the standard error write in the same logfile
-m abe Have moab mail a notification to you if the job gets aborted, begins or ends. You can use any combination of these letter, for example "-m e" if you are only interested if a jobs finishes.
-l walltime=hh:mm:ss Tell the scheduler that your job will run for hh hours, mm minutes and ss seconds. Remember that some queues have a time limit, for example 4 hours for the backfill queue, and that moab will reject your job if you request more time. The default walltime is 14 days for most queues, while the maximum is 90 days. The default and the maximum walltime for the backfill queue is 4 hours. See the FAQ on how to increase the walltime of a running job, up to the maximum walltime.
-q queue Specify the queue to run in.
-l qos=QOS Specify the quality of service QOS for this job. See the section on the different queues for all possible quality of service levels that you can use.