@@ -12,8 +12,11 @@ patchClusterFunctionsSlurm2 <- function(cf) {
1212 nodename <- env [[" nodename" ]]
1313 org_listJobsQueued <- env [[" listJobsQueued" ]]
1414
15- # # Inject runOSCommand() that defaults to runOSCommand(..., stderr = FALSE)
16- env [[" runOSCommand" ]] <- function (... , stderr = FALSE ) {
15+ # # Patch submitJob() to use runOSCommand(..., stderr = FALSE)
16+ # # See https://github.com/mlr-org/batchtools/pull/314
17+ submitJob <- cf [[" submitJob" ]]
18+ env_submitJob <- new.env(parent = environment(submitJob ))
19+ env_submitJob [[" runOSCommand" ]] <- function (... , stderr = FALSE ) {
1720 debug <- isTRUE(getOption(" future.batchtools.debug" ))
1821 if (debug ) {
1922 mdebugf_push(" runOSCommand(..., stderr = FALSE) ..." )
@@ -22,6 +25,8 @@ patchClusterFunctionsSlurm2 <- function(cf) {
2225 }
2326 runOSCommand(... , stderr = stderr )
2427 }
28+ environment(submitJob ) <- env_submitJob
29+ cf [[" submitJob" ]] <- submitJob
2530
2631 # # Allow for a 15-minute offset in time between host and Slurm's sacct server
2732 isJobQueued <- function (reg , batch_id , since = NULL , offset = 15 * 60 ) {
@@ -84,11 +89,16 @@ patchClusterFunctionsSlurm2 <- function(cf) {
8489
8590# ' ClusterFunctions for Slurm Systems (patched)
8691# '
87- # ' This functions enhances [batchtools::makeClusterFunctionsSlurm()] by
88- # ' patching the `listJobsQueued()` cluster function such that it falls
89- # ' back to querying Slurm's account database (`sacct`), if the future was
90- # ' _not_ found in the Slurm job queue (`squeue`), which might be the case
92+ # ' This functions enhances [batchtools::makeClusterFunctionsSlurm()] with
93+ # ' a few patches.
94+ # ' Firstly, it patches the `listJobsQueued()` cluster function such that it
95+ # ' falls back to querying Slurm's account database (`sacct`), if the future
96+ # ' was _not_ found in the Slurm job queue (`squeue`), which might be the case
9197# ' when Slurm provisions a job that was just submitted to the scheduler.
98+ # ' Secondly, it patched the `submitJob()` cluster function such that the
99+ # ' system call to `sbatch` does to capture stderr together with stdout, but
100+ # ' rather separately such that any extra INFO messages from `sbatch` do
101+ # ' not corrupt the output intended to come from stdout only.
92102# '
93103# ' @inheritParams batchtools::makeClusterFunctionsSlurm
94104# '
0 commit comments