skip to main content

Running an example job

Example PBS jobs for many of our programs can be found in /usr/local/apps/example_jobs. This page describes how to run one of those jobs in particular, but could be applied to any of them.

To get a list of all example jobs available on a system, run:
ls /usr/local/apps/example_jobs

If you find that an example job you need is not available, please contact the MCSR staff. We are always happy to help users get their projects going.

Run the command below to copy the example Python job to your home directory. Substitute the name of the system you are on for “maple.”
cp -r /usr/local/apps/example_jobs/python_maple_example/ ~

Change into the directory that you just copied over:
cd python_maple_example/

Have a quick look at the PBS script that you’re about to use:
cat prime.pbs
For an explanation of the PBS script, see Example PBS Script.

Then submit the PBS script:
qsub prime.pbs

When you submit the job, PBS checks to see if the resources required for the job are available. If they are, your job is executed on a compute node.

You should receive a job ID number from the qsub command that will allow you to check the status of your job:
qstat your_number_goes_here

bnp@maple:~/python_maple_example> qstat 284861
Job id            Name             User              Time Use S Queue
----------------  ---------------- ----------------  -------- - -----
284861.maple      prime            bnp               00:00:11 R workq

If you need more information about your job, use the -f option:
qstat -f your_number_goes_here

When qstat returns “Job has finished, use -x or -H to obtain historical job information,” you know that your job has finished. Run:
ls
to look for output files. Output filenames generally look like job_name.ojob_id. For instance, the name of this job is prime (the name is defined in the PBS script). When I ran this example, my  job ID was 3220, so my output filename was prime.o3220. The output file is a simple text file, so cat can be used to view it:
cat prime.o3220

Don’t forget to substitute your job ID.

Some jobs also produce an error file, with an e instead of an o. This will contain any errors produced by the job. Some jobs (like the Python job above) combine standard output and error output into one file.