submit: Submit: Submit an R script to a Slurm cluster

Description Usage Arguments Details See Also Examples

View source: R/slurmSubmit.R

Description

This generic function is used to submit a Rscript job to a Slurm cluster. Current support is for Singularity and Conda environments.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
submit(x, ...)

## Default S3 method:
submit(
  job.name,
  script.file = "",
  cluster = "",
  slurm.args = "",
  script.args = "",
  conda = "",
  singularity = "docker://rocker/r-base:latest",
  r.bin.args = "",
  target.dir = "~",
  r.data = "",
  local.data = "",
  profile = JobProfile(),
  save.profile.name = "",
  VERBOSE = FALSE,
  save.sub = FALSE
)

## S3 method for class 'Submission'
submit(sub, job.name = "R-slurmSubmit", save.sub = FALSE, VERBOSE = FALSE)

Arguments

x

A Submission class object, or a string containing a name for a new job submission.

...

Other arguments

job.name

Name of job to be submitted. REQUIRED for default method.

script.file

Relative path to the script

cluster

Address of cluster you want to submit to.

slurm.args

String containing all sbatch arguments for your submission. Takes precedence over values in the JobProfile passed to the profile argument.

script.args

String containing all arguments to the submitted Rscript to be executed remotely on the cluster.

conda

String containing the name of a valid conda environment on the cluster to be used to execute R.

singularity

String path or URI of a Singularity container to execute Rscript inside of.

r.bin.args

String containing all arguments to pass to the RScript binary.

target.dir

Path to directory to create .slurmsubmit/ directory.

r.data

A character vector containing the name(s) of valid R data objects in the search path. This data will be made available locally on the cluster in the same directory as the script under the file handle Rdata.

local.data

String containing a list of paths to one or more local file(s). WARNING: Large files may take a long time to sync.

profile

A JobProfile type object.

save.profile.name

If specified, will save the generated profile object under the specified name in .Globalenv.

VERBOSE

Show more details.

save.sub

If TRUE will save this job submission as a Submission type object under job.name.

sub

A Submission type object

Details

It is suggested that you use clean.remote() after your job has completed to clean the remote address of the .slurmSubmit/ hidden directory.

See Also

Submission, JobProfile, clean.remote

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Naive method
submit("example", cluster="login.sumner.jax.org", slurm.args="-q batch")

# Without any job profile specified, the default JobProfile object will be used.

# The preferred method is to define a Submission type object to pass to submit()

exampleProfile = JobProfile(cpus=2, memory="4G", qos="batch",email.complete="matt.bradley@jax.org")
exampleSub = Submission(script.file="example.R", cluster="login.sumner.jax.org", profile=exampleProfile)

submit(exampleSub, job.name="example")

#This will save a Submission type object named "example" after completing successfully.

# Alternatively, submit.default will create a new Submission object using passed parameters. It is important
# to note that job.name is required to trigger the default method. In this example we will also define
# sbatch arguments using the slurm.args argument. Since save.sub=TRUE, this will create a new Submission
# type object in .GlobalEnv named "example".

submit("example", script.file="example.R", cluster="login.sumner.jax.org",
       slurm.args="-c 2 --mem=4G, -q batch --mail-type=END --mail-user=matt.bradley@jax.org",
       save.sub=TRUE)

TheJacksonLaboratory/slurmSubmit documentation built on Dec. 18, 2021, 4:09 p.m.