@@ -856,23 +856,27 @@ await <- function(future, cleanup = TRUE, ...) {
856856 # # SPECIAL CASE: Some Slurm users report on 'expired' jobs, although they never started.
857857 # # Output more breadcrumbs to be able to narrow in on what causes this. /HB 2025-09-07
858858 if (inherits(future , " BatchtoolsSlurmFuture" )) {
859- # # Get _all_ jobs of the users, including those not submitted via future.batchtools
860- slurm_job_ids <- unique(c(
861- reg $ cluster.functions $ listJobsQueued(reg ),
862- reg $ cluster.functions $ listJobsRunning(reg )
863- ))
864- if (length(slurm_job_ids ) > 0 ) {
865- info <- sprintf(" Slurm job ID: [n=%d] %s" , length(slurm_job_ids ), commaq(slurm_job_ids ))
859+ batch_id <- reg [[" status" ]][[" batch.id" ]]
860+ if (length(batch_id ) > 0 ) {
861+ info <- sprintf(" Slurm job ID: [n=%d] %s" , length(batch_id ), commaq(batch_id ))
866862
867- args <- c(" --noheader" , " --format='job_id=%i,state=%T,submitted_on=%V,time_used=%M'" , sprintf(" --jobs=%s" , paste(slurm_job_ids , collapse = " ," )))
863+ args <- c(" --noheader" , " --format='job_id=%i,state=%T,submitted_on=%V,time_used=%M'" , sprintf(" --jobs=%s" , paste(batch_id , collapse = " ," )))
868864 res <- system2(" squeue" , args = args , stdout = TRUE , stderr = TRUE )
869- res <- paste(res , collapse = " \n " )
870- info <- c(info , sprintf(" Slurm 'squeue' job status:\n %s" , res ))
871-
872- args <- c(" --noheader" , " --parsable2" , " --allocations" , " --format='JobID,State,ExitCode'" , sprintf(" --jobs=%s" , paste(slurm_job_ids , collapse = " ," )))
865+ if (length(res ) == 0 ) {
866+ res <- " <empty>"
867+ } else {
868+ res <- paste(res , collapse = " ; " ) # # should only be one, but just in case ...
869+ }
870+ info <- c(info , sprintf(" Slurm 'squeue' job status: %s" , res ))
871+
872+ args <- c(" --noheader" , " --parsable2" , " --allocations" , " --format='JobID,State,ExitCode'" , sprintf(" --jobs=%s" , paste(batch_id , collapse = " ," )))
873873 res <- system2(" sacct" , args = args , stdout = TRUE , stderr = TRUE )
874- res <- paste(res , collapse = " \n " )
875- info <- c(info , sprintf(" Slurm 'sacct' job status:\n %s" , res ))
874+ if (length(res ) == 0 ) {
875+ res <- " <empty>"
876+ } else {
877+ res <- paste(res , collapse = " ; " ) # # should only be one, but just in case ...
878+ }
879+ info <- c(info , sprintf(" Slurm 'sacct' job status: %s" , res ))
876880 } else {
877881 info <- " Slurm job ID: <not found>"
878882 info <- c(info , sprintf(" Slurm job status: <unknown>" ))
0 commit comments