Skip to content

Commit d85bc2f

Browse files
CLEANUP: Only needs to call cancel() on interrupts; it's already done by future::value() on errors
1 parent 82e393f commit d85bc2f

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: future.apply
2-
Version: 1.11.3-9014
2+
Version: 1.11.3-9015
33
Title: Apply Function to Elements in Parallel using Futures
44
Depends:
55
R (>= 3.2.0),

R/future_xapply.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ future_xapply <- local({
300300
}) ## withCallingHandlers()
301301
} else {
302302
## value() exits early if it detects a future with an error.
303-
## In future (> 1.40.0), non-resolved futures will be automatically
303+
## In future (>= 1.40.0), non-resolved futures will be automatically
304304
## canceled if there's an error.
305305
value(fs)
306306
}
@@ -312,12 +312,12 @@ future_xapply <- local({
312312
host <- Sys.info()[["nodename"]]
313313
pid <- Sys.getpid()
314314
msg <- sprintf("%s() interrupted at %s, while running on %s (pid %s)", fcn_name, format(when, format = "%FT%T"), sQuote(host), pid)
315-
warning(sprintf("%s. Cleaning up ...", msg), immediate. = TRUE, call. = FALSE)
315+
warning(sprintf("%s. Canceling all iterations ...", msg), immediate. = TRUE, call. = FALSE)
316+
317+
## Interrupt all futures (if an error, value() already did it)
318+
fs <- cancel(fs)
316319
}
317320

318-
## Interrupt all futures
319-
fs <- cancel(fs)
320-
321321
## Make sure all workers finish before continuing
322322
fs <- resolve(fs)
323323

inst/testme/test-globals,tricky2.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#' @tags detritus-files
44
#' @tags sequential multisession multicore
55

6-
if (packageVersion("future") > "1.40.0-9200") {
6+
if (packageVersion("future") > "1.49.0" && isTRUE(getOption("future.globals.keepWhere"))) {
77

88
library(future.apply)
99
options(future.debug = FALSE)

0 commit comments

Comments
 (0)