batch_writer: Write a slurm batch script file

View source: R/batch_writer.R

batch_writerR Documentation

Write a slurm batch script file

Description

A wrapper around writing the script given the desired command, a short name for the job, and many optional parameters. Defaults are for my current setup (latest R version on cluster).

Usage

batch_writer(
  commands,
  name,
  R = "4.0.0",
  mem = NA,
  time = NA,
  nodes = 1,
  threads = 1,
  array = NA,
  partition = "biostat",
  account = NA,
  email = NA
)

Arguments

commands

A character vector of commands to run, one per line.

name

Short name for for batch script file, job, and stdout/stderr output paths

R

Specify R version, to load module (NA prevents loading R).

mem

Memory limit. NA (default) is no memory limit. May be a string like ⁠1G⁠, whatever sbatch accepts.

time

Time limit. NA (default) is no time limit. May be a string like 1:00:00, whatever sbatch accepts.

nodes

Number of nodes to use (default 1).

threads

Number of tasks per node (default 1).

array

Value for array jobs (default NA is not an array job; typical values are numeric ranges passed as strings, such as "1-50", "0-90", or discontinuous ranges such as "1,4,10-20").

partition

The partition to submit to, by default biostat. If NA then no partition is declared (default partition will be used, common in DCC?).

account

Account to use. NA (default) is default account for user.

email

Address to receive emails about job completion.

See Also

batch_submit() to submit slurm batch scripts. batch_cleanup() to remove slurm batch scripts.

Examples


# set desired parameters
commands <- 'time echo "Hello world!"'
name <- 'hola'

# writes file `hola.q`
batch_writer(
    commands,
    name
)

# cleanup
batch_cleanup( name )


OchoaLab/ochoalabtools documentation built on July 28, 2024, 12:37 p.m.