R/batchtools_local.R
batchtools_local.RdThe batchtools local backend is useful for verifying parts of your batchtools setup locally, before using a more advanced backend such as the job-scheduler backends.
batchtools_local(
...,
fs.latency = 0,
delete = getOption("future.batchtools.delete", "on-success")
)[numeric(1)]
Expected maximum latency of the file system, in seconds.
Set to a positive number for network file systems like NFS which enables more robust (but also more expensive) mechanisms to
access files and directories.
Usually safe to set to 0 to disable the heuristic, e.g. if you are working on a local file system.
Controls if and when the batchtools job registry folder is
deleted.
If "on-success" (default), it is deleted if the future was resolved
successfully and the expression did not produce an error.
If "never", then it is never deleted.
If "always", then it is always deleted.
Not used.
Batchtools local futures use batchtools cluster functions
created by batchtools::makeClusterFunctionsInteractive() with
external = TRUE.
An alternative to the batchtools interactive backend is to use
plan(future::cluster, workers = I(1)).
library(future)
plan(future.batchtools::batchtools_local)
message("Main process ID: ", Sys.getpid())
#> Main process ID: 942212
f <- future({
data.frame(
hostname = Sys.info()[["nodename"]],
os = Sys.info()[["sysname"]],
cores = unname(parallelly::availableCores()),
pid = Sys.getpid(),
modules = Sys.getenv("LOADEDMODULES")
)
})
info <- value(f)
#> Warning: batchtools::waitForJobs(..., timeout = 2592000) returned FALSE
#> Warning: Will not remove batchtools registry, because the status of the batchtools was ‘error’, ‘defined’, ‘expired’, ‘submitted’ and future backend argument 'delete' is ‘on-success’: ‘/cluster-data/user-homes/elizabethb/projects/prism-pkgdocs-build/installed-pkgs/2025-09-29/future.batchtools_0.21.0/docs/reference/.future/20251001_140005-Cj9EW1/batchtools_850368204’
#> Error: Future (<unnamed-3>) of class BatchtoolsLocalFuture expired, which indicates that it crashed or was killed.
#> Post-mortem details:
#> Future state: ‘running’
#> Batchtools status: ‘defined’, ‘expired’, ‘submitted’
#> No logged output file exist (at the moment)
print(info)
#> Error: object 'info' not found