diff --git a/DESCRIPTION b/DESCRIPTION index b1629cda..f0998e8a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: future -Version: 1.33.2-9004 +Version: 1.33.2-9005 Title: Unified Parallel and Distributed Processing in R for Everyone Imports: digest, diff --git a/R/zzz.plan.R b/R/zzz.plan.R index 0c07a2ed..6bf5fe43 100644 --- a/R/zzz.plan.R +++ b/R/zzz.plan.R @@ -190,7 +190,7 @@ plan <- local({ ## Backward compatibility for future (<= 1.33.2) ## ClusterRegistry(action = "stop") } - } + } ## plan_cleanup() plan_init <- function() { evaluator <- stack[[1L]] @@ -238,7 +238,7 @@ plan <- local({ paste(sQuote(class(evaluator)), collapse = ", ")) } } - } + } ## plan_init() equal_strategy_stacks <- function(stack, other) { @@ -295,7 +295,7 @@ plan <- local({ !is.na(nbrOfWorkers), nbrOfWorkers >= 1L) invisible(oldStack) - } + } ## plan_set() ## Main function @@ -320,7 +320,7 @@ plan <- local({ ## List stack of future strategies? return(stack) } else if (identical(strategy, "reset")) { - ## Stop any (implicitly started) clusters? + ## Stop/cleanup any previously registered backends? if (.cleanup) plan_cleanup() ## Reset stack of future strategies? stack <<- defaultStack diff --git a/tests/multisession.R b/tests/multisession.R index dfe1f252..f932ab35 100644 --- a/tests/multisession.R +++ b/tests/multisession.R @@ -159,6 +159,7 @@ stopifnot(v == yTruth) message("*** multisession(..., workers = 1L) ... DONE") + message("*** multisession(..., gc = TRUE) ...") plan(multisession, workers = 2L) @@ -189,6 +190,11 @@ message("*** multisession(...) - stopping with plan() change ...") plan(multisession, workers = 2L) f <- future(1L) + +## Collect value, to speep up the stopping of the parallel workers, +## and to make sure we're not leaving any stray processes behind. +v <- value(f) + cl <- ClusterRegistry("get") stopifnot(inherits(cl, "cluster"), length(cl) >= 1L)