submit_slurm_job Reference
This guide assumes you are familiar with submitting NONMEM jobs using the default arguments, and are looking for more control over you job submission. We’ll cover each argument to submit_slurm_job and overriding the default. You should be able to combine any combination of arguments to suit your needs.
Using the partition & ncpu arguments
By default, submit_slurm_job uses the smallest partition available to you. This could be something like cpu2mem4gb. For models requiring more memory or CPUs, you can specify these arguments to better suit your needs. To view available partitions, refer to get_slurm_partitions.
specifying a higher memory partition
library(slurmtools)library(bbr)
mod <- bbr::read_model(file.path("path", "to", "nonmem", "models", "1001"))submit_slurm_job(mod, partition = "cpu16mem128gb")Using more cores with ncpu
Set ncpu to any number up to the number of cores in your partition. For instance, with the cpu16mem128gb partition, ncpu can be set from 1 to 16.
library(slurmtools)library(bbr)
mod <- bbr::read_model(file.path("path", "to", "nonmem", "models", "1001"))submit_slurm_job(mod, partition = "cpu16mem128gb", ncpu = 8)Using the overwrite argument
By default, submit_slurm_job will not overwrite previously run models. Set overwrite = TRUE to override this.
library(slurmtools)library(bbr)
mod <- bbr::read_model(file.path("path", "to", "nonmem", "models", "1001"))submit_slurm_job(mod, overwrite = TRUE)Using the dry_run argument
By default, dry_run = FALSE and the sbatch command is executed. Setting dry_run = TRUE allows you to preview the template file without submitting it.
library(slurmtools)library(bbr)
mod <- bbr::read_model(file.path("path", "to", "nonmem", "models", "1001"))submit_slurm_job(mod, dry_run = TRUE)This gives the following output
$cmd sbatch"/opt/slurm/bin/sbatch"
$args[1] "/path/to/nonmem/models/submission-log/1001.sh"
$template_script[1] "#!/bin/bash <rest of template omitted>"
$partition[1] "cpu16mem64gb"Using the slurm_job_template_path argument
By default, submit_slurm_job uses getOption('slurmtools.slurm_job_template_path') for the path to the template file (see Getting Started Guide if you’re unfamiliar with the slurmtools options). You can update this argument to use a different template file as needed.
library(slurmtools)library(bbr)
nonmem_path <- file.path("path", "to", "nonmem", "models")
mod <- bbr::read_model(file.path(nonmem_path, "1001"))submit_slurm_job( mod, slurm_job_template_path = file.path(nonmem_path, "new-slurm-job.tmpl"))Using the submission_root argument
This directory is used to track submission scripts and output. It will be populated with the shell scripts created from filling in the template file when calling submit_slurm_job and the stdout/stderr from the bash script. If you would like to set it and forget it use the slurmtools option options('slurmtools.submission_root') (see the Getting Started Guide if you are unfamiliar with this option). If you’d like to set this at runtime simply provide the path to the directory you’d like to save the output to.
library(slurmtools)library(bbr)
nonmem_path <- file.path("path", "to", "nonmem", "models")
mod <- bbr::read_model(file.path(nonmem_path, "1001"))submit_slurm_job( mod, slurm_job_template_path = file.path(nonmem_path, "new-slurm-job.tmpl"))Using the bbi_config_path argument
If you are using bbi to submit nonmem jobs this specifies the path to the bbi config file bbi.yaml. By default, submit_slurm_job uses the slurmtools option options('slurmtools.bbi_config_path) (see the Getting Started Guide if you are unfamiliar with this option). If you would like to use a different configuration for bbi you can specify the path to a new config file and use that.
library(slurmtools)library(bbr)
nonmem_path <- file.path("path", "to", "nonmem", "models")
mod <- bbr::read_model(file.path(nonmem_path, "1001"))submit_slurm_job( mod, bbi_config_path = file.path(nonmem_path, "new-bbi.yml"))Using the slurm_template_opts argument
If additional arguments are needed in your template file, pass them via slurm_template_opts as a named list. For example, to set an email for notifications:.
library(slurmtools)library(bbr)
mod <- bbr::read_model(file.path("path", "to", "nonmem", "models", "1001"))submit_slurm_job( mod, slurm_template_opts = list("email" = "matthews@a2-ai.com"))This will cause any instances of {{email}} in your template file to be replaced with matthews@a2-ai.com. If you are unfamiliar with template file structure, please see the guide on writing template files