Skip to content

Commit fe70036

Browse files
batchtools_slurm(): add example for using 'envs' and 'rscript' to launch R within a Linux container using Apptainer
1 parent aec6d3c commit fe70036

File tree

3 files changed

+55
-5
lines changed

3 files changed

+55
-5
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: future.batchtools
2-
Version: 0.20.0-9021
2+
Version: 0.20.0-9022
33
Depends:
44
R (>= 3.2.0),
55
parallelly,

R/batchtools_slurm.R

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,36 @@ print.BatchtoolsSlurmFutureBackend <- function(x, ...) {
9898
#' ))
9999
#'
100100
#' f <- future({
101+
#' readRenviron("/etc/os-release")
101102
#' data.frame(
102103
#' hostname = Sys.info()[["nodename"]],
103104
#' os = Sys.info()[["sysname"]],
104-
#' cores = unname(parallelly::availableCores()),
105-
#' modules = Sys.getenv("LOADEDMODULES")
105+
#' distro = Sys.getenv("PRETTY_NAME"),
106+
#' cores = unname(parallelly::availableCores())
107+
#' )
108+
#' })
109+
#' info <- value(f)
110+
#' print(info)
111+
#'
112+
#' # As above, but run R within the Rocker 'r-base' Linux container.
113+
#' # It assumes that 'future.batchtools' has been installed in the
114+
#' # container already to the below 'R_LIBS_USER' library path.
115+
#' plan(future.batchtools::batchtools_slurm, resources = list(
116+
#' time = "00:10:00", mem = "400M",
117+
#' asis = c("--nodes=1", "--ntasks=4", "--partition=freecycle"),
118+
#' modules = c("r", "jags"),
119+
#' details = TRUE,
120+
#' envs = c(R_LIBS_USER="~/R/rocker-%p-library/%v-CBI-gcc13"),
121+
#' rscript = c("apptainer", "exec", "~/lxc/rocker_r-base.sif", "*")
122+
#' ))
123+
#'
124+
#' f <- future({
125+
#' readRenviron("/etc/os-release")
126+
#' data.frame(
127+
#' hostname = Sys.info()[["nodename"]],
128+
#' os = Sys.info()[["sysname"]],
129+
#' distro = Sys.getenv("PRETTY_NAME"),
130+
#' cores = unname(parallelly::availableCores())
106131
#' )
107132
#' })
108133
#' info <- value(f)

man/batchtools_slurm.Rd

Lines changed: 27 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)