Skip to content

Commit 92cb9cc

Browse files
Make sure resolved() returns TRUE for canceled futures
1 parent ed95396 commit 92cb9cc

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
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.12.2-9908
2+
Version: 0.12.2-9909
33
Depends:
44
R (>= 3.2.0),
55
parallelly,

R/BatchtoolsFuture-class.R

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,10 @@ status <- function(future, ...) {
435435
debug <- isTRUE(getOption("future.debug"))
436436
if (debug) {
437437
mdebugf_push("status() for %s ...", class(future)[1])
438-
on.exit(mdebug_pop())
438+
on.exit({
439+
mdebugf("Status: %s", paste(sQuote(status), collapse = ", "))
440+
mdebug_pop()
441+
})
439442
}
440443

441444
## WORKAROUND: Avoid warnings on partially matched arguments
@@ -484,13 +487,13 @@ status <- function(future, ...) {
484487
result <- future$result
485488
if (inherits(result, "FutureResult")) {
486489
if (result_has_errors(result)) status <- unique(c("error", status))
490+
} else if (inherits(result, "FutureError")) {
491+
status <- unique(c("error", status))
487492
}
488493

489494
## Cache result
490495
future$.status <- status
491496

492-
if (debug) mdebug("Status: ", paste(sQuote(status), collapse = ", "))
493-
494497
status
495498
}
496499

@@ -587,6 +590,10 @@ resolved.BatchtoolsFuture <- function(x, ...) {
587590
resolved <- finished(x)
588591
if (is.na(resolved)) return(FALSE)
589592

593+
if (!resolved && x[["state"]] == "canceled") {
594+
return(TRUE)
595+
}
596+
590597
## Signal conditions early? (happens only iff requested)
591598
if (resolved) signalEarly(x, ...)
592599

0 commit comments

Comments
 (0)