@@ -28,10 +28,10 @@ print.BatchtoolsSlurmFutureBackend <- function(x, ...) {
2828# '
2929# ' @details
3030# ' Batchtools slurm futures use \pkg{batchtools} cluster functions
31- # ' created by [batchtools::makeClusterFunctionsSlurm ()], which are used
31+ # ' created by [makeClusterFunctionsSlurm2 ()], which are used
3232# ' to interact with the Slurm job scheduler. This requires that Slurm
33- # ' commands `sbatch`, `squeue`, and `scancel` are available on the current
34- # ' machine.
33+ # ' commands `sbatch`, `squeue`, `sacct`, and `scancel` are available on
34+ # ' the current machine.
3535# '
3636# ' The default template script `templates/slurm.tmpl` can be found in:
3737# '
@@ -43,7 +43,7 @@ print.BatchtoolsSlurmFutureBackend <- function(x, ...) {
4343# '
4444# ' `r paste(c("\x60\x60\x60bash", readLines("inst/templates/slurm.tmpl"), "\x60\x60\x60"), collapse = "\n")`
4545# '
46- # ' This template and the built-in [batchtools::makeClusterFunctionsSlurm ()]
46+ # ' This template and the built-in [makeClusterFunctionsSlurm2 ()]
4747# ' have been verified to work on a few different Slurm HPC clusters;
4848# '
4949# ' 1. Slurm 21.08.4, Rocky Linux 8, NFS global filesystem (August 2025)
@@ -265,10 +265,25 @@ patchClusterFunctionsSlurm2 <- function(cf) {
265265} # # patchClusterFunctionsSlurm2()
266266
267267
268- # ' @importFrom batchtools makeClusterFunctionsSlurm
269268
270- makeClusterFunctionsSlurm2 <- function (template = " slurm" , array.jobs = TRUE , nodename = " localhost" , scheduler.latency = 1 , fs.latency = 65 , ... ) {
271- cf <- makeClusterFunctionsSlurm(template = template , array.jobs = array.jobs , nodename = nodename , scheduler.latency = scheduler.latency , fs.latency = fs.latency , ... )
269+
270+ # ' ClusterFunctions for Slurm Systems (robustified)
271+ # '
272+ # ' This functions enhances [batchtools::makeClusterFunctionsSlurm()] by
273+ # ' patching the `listJobsQueued()` cluster function such that it falls
274+ # ' back to querying Slurm's account database (`sacct`), if the future was
275+ # ' _not_ found in the Slurm job queue (`squeue`), which might be the case
276+ # ' when Slurm provisions a job that was just submitted to the scheduler.
277+ # '
278+ # ' @inheritParams batchtools::makeClusterFunctionsSlurm
279+ # '
280+ # ' @return
281+ # ' A [batchtools::ClusterFunctions] object.
282+ # '
283+ # ' @importFrom batchtools makeClusterFunctionsSlurm
284+ # ' @export
285+ makeClusterFunctionsSlurm2 <- function (template = " slurm" , array.jobs = TRUE , nodename = " localhost" , scheduler.latency = 1 , fs.latency = 65 ) {
286+ cf <- makeClusterFunctionsSlurm(template = template , array.jobs = array.jobs , nodename = nodename , scheduler.latency = scheduler.latency , fs.latency = fs.latency )
272287 cf <- patchClusterFunctionsSlurm2(cf )
273288 cf
274289}
0 commit comments