Skip to main content

5.10) Batch Job Submission


Batch jobs are jobs that can be assigned to a compute node and run to completion without any further user intervention. This means that all application options, command line options, input data, output file etc. are selected or determined via a script. This script can then be submitted to the batch scheduler, along with a list of required resources.

A suitable script will consist of a list of UNIX commands that should be run in sequence by the interpreting shell. The bash shell is the default on ARC2. The script can simply consist of a list of requested resources and name of executable to be run. It can also include copying, directory access commands or more complex workflows.

A simple script, example.sh, can take the form:

[bash]
#!/bin/bash
# example.sh a simple script
# print name of host
echo “running on” $HOSTNAME
# change directory
cd work_dir
# Run my program
./myprog
# copy results to safe location
cp resultsfile ~/results_dir
# remove temporary files
rm *.tmp
[/bash]

Note: it good practice to specify which shell should run your script, hence the #!/bin/bash at top of the script.