submit_job: Submit a script as a job to the Slurm cluster

View source: R/submit_job.R

submit_jobR Documentation

Submit a script as a job to the Slurm cluster

Description

Function contains internal defaults for R and Python shell scripts. Function will build log paths automatically.

Usage

submit_job(
  script_path = NULL,
  threads = 2L,
  mem = "10G",
  runtime_min = 15L,
  account = NULL,
  console_style_log_tf = FALSE,
  std_err_root = file.path("/mnt/share/temp/slurmoutput", Sys.info()[["user"]], "error"),
  std_out_root = file.path("/mnt/share/temp/slurmoutput", Sys.info()[["user"]], "output"),
  array_tasks_int = NULL,
  archiveTF = TRUE,
  job_name = NULL,
  partition = "all.q",
  hold_for_JobIDs = NULL,
  language = "R",
  r_image = NULL,
  shell_script_path = NULL,
  args_list = NULL,
  args_include_script = TRUE,
  arg_vecs_to_comma_str = TRUE,
  verbose = TRUE,
  v_verbose = FALSE,
  send_email = FALSE,
  email_address = paste0(Sys.info()[["user"]], "@uw.edu"),
  dry_runTF = FALSE
)

Arguments

script_path

[chr] full path to submitted script

threads

[int] cluster resource requirement

mem

[chr] cluster resource requirement

runtime_min

[num] cluster resource requirement

account

[chr] a.k.a. 'project' - cluster resource requirement

console_style_log_tf

[lgl] if TRUE, combine std_err and std_out into one log in the std_out_root

std_err_root

[chr] path for Slurm std_err logs

std_out_root

[chr] path for Slurm std_out logs

array_tasks_int

[int] (default: NULL - if not NULL, array job is assumed) - vector of integers for you array (e.g. c(1L:10L))

archiveTF

[lgl] (default FALSE) do you need an archive node?

job_name

[chr] Will be name of script if NULL

partition

[chr] a.k.a. 'queue' - cluster resource requirement

hold_for_JobIDs

vector of jobids that must complete successfully before running this job (https://slurm.schedmd.com/sbatch.html#OPT_dependency)

language

[chr] coding language for job (see valid_langs validation)

r_image

[chr] (default "latest.img") e.g. "/mnt/share/singularity-images/rstudio/ihme_rstudio_4214.img"

shell_script_path

[path] path to shell script (language-specific)

args_list

[list, chr] optional named list() of arguments, e.g. list("arg1" = arg1, "arg2" = arg2)

args_include_script

[lgl] if TRUE, include script_path in args_list

arg_vecs_to_comma_str

[lgl] if TRUE, convert atomic elements of args_list to comma-separated strings

verbose

[lgl] print submission command and job_id

v_verbose

[lgl] print log paths

send_email

[lgl] send email on job completion?

email_address

[chr] email address to send job completion notification

dry_runTF

[lgl] (default FALSE) if TRUE, only message and return submission command, no job submission

Value

[int] job_id of submitted job, also messsage with job_id and job_name

See Also

Other job_submission: parse_all_named_cli_args()


epi-sam/SamsElves documentation built on June 12, 2025, 7 a.m.