@@ -540,23 +540,23 @@ status <- function(future, ...) {
540540
541541 # # Optionally filter by the scheduler's job ID, if it exists
542542 batch_id <- reg [[" status" ]][[" batch.id" ]]
543- if (! is.null(batch_id )) {
543+ if (! is.null(batch_id ) && inherits( future , " BatchtoolsTemplateFutureBackend " ) ) {
544544 if (! is.character(batch_id ) || length(batch_id ) != 1L || is.na(batch_id ) || ! nzchar(batch_id ) || ! grepl(" ^[[:digit:].]+$" , batch_id )) {
545545 stop(sprintf(" Unknown value of 'batch.id': [class=%s] %s" , class(batch_id )[1 ], paste(sQuote(batch_id ), collapse = " , " )))
546546 }
547+
548+ # # Pass this to cluster functions listJobsQueued() and listJobsRunning()
549+ # # via an R option, because we cannot pass as an argument.
550+ options(
551+ future.batchtools.batch_id = batch_id ,
552+ future.batchtools.submitted_on = future [[" submitted_on" ]]
553+ )
554+ on.exit(options(
555+ future.batchtools.batch_id = NULL ,
556+ future.batchtools.submitted_on = NULL
557+ ), add = TRUE )
547558 }
548559
549- # # Pass this to cluster functions listJobsQueued() and listJobsRunning()
550- # # via an R option, because we cannot pass as an argument.
551- options(
552- future.batchtools.batch_id = batch_id ,
553- future.batchtools.submitted_on = future [[" submitted_on" ]]
554- )
555- on.exit(options(
556- future.batchtools.batch_id = NULL ,
557- future.batchtools.submitted_on = NULL
558- ), add = TRUE )
559-
560560 status <- get_status(reg = reg , ids = jobid )
561561 status <- (unlist(status ) == 1L )
562562 status <- status [status ]
0 commit comments