Child pages
  • Putting all pieces together - an R example
Skip to end of metadata
Go to start of metadata


Pulling it all together - Preparing, submitting and monitoring a job on Prince

 In this section we will prepare, submit and monitor a small R job. Our test case comes from the NYU Data Services "Introduction to R" tutorial


Start a terminal session on Prince and replicate this example in it. 

Choose your own example

After - or instead of - following this example through, prepare and submit a run of something genuinely relevant to your research. This way, if you are doing this tutorial in a classroom, the presenter will be available should you have questions or strike difficulties

We're using R, so first we'll look for available modules. On Prince:

There's a few modules starting with r, and a couple of versions of R. We'll use the latest version, 3.1.2.

Take a look at what it did:

... clearly, R uses a lot of other packages. The modulefile has looked after loading the correct ones.

For our example, we'll get some code and data from /share/apps/examples:

Hint: there are usage examples for a few common packages here

$ mkdir /beegfs/$USER/R-example
$ cd !$
$ cp
/share/apps/examples/r/basic/* .

Take a look at the job script:

There are a few steps we can try here:

  1. Start an interactive batch session, and run the example.R script interactively
  2. Close the interactive session, and submit the batch script as a job:

$ sbatch my_R_job.s

You'll get a job id returned.

Is it running yet?

$ squeue -u $USER

You could watch the output in the run directory:

$ ls -l ${SCRATCH}/R-example

Finally, when the job finishes, you should see a .out file in the directory you submitted from.



 Experiment with sbatch options for the job name, output and error file merging and location, resource limits.

  • No labels