Skip to content

Commit 4fe33e4

Browse files
Asssertion of internal 'batch.id' only for BatchtoolsTemplateFutureBackend
1 parent c342e4f commit 4fe33e4

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: future.batchtools
2-
Version: 0.20.0-9014
2+
Version: 0.20.0-9015
33
Depends:
44
R (>= 3.2.0),
55
parallelly,

R/BatchtoolsFutureBackend-class.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)