Skip to content

Commit

Permalink
Fix one detritus issue
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed May 30, 2024
1 parent 070e487 commit b25ac79
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
8 changes: 4 additions & 4 deletions R/zzz.plan.R
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ plan <- local({
## Backward compatibility for future (<= 1.33.2)
## ClusterRegistry(action = "stop")
}
}
} ## plan_cleanup()

plan_init <- function() {
evaluator <- stack[[1L]]
Expand Down Expand Up @@ -238,7 +238,7 @@ plan <- local({
paste(sQuote(class(evaluator)), collapse = ", "))
}
}
}
} ## plan_init()


equal_strategy_stacks <- function(stack, other) {
Expand Down Expand Up @@ -295,7 +295,7 @@ plan <- local({
!is.na(nbrOfWorkers), nbrOfWorkers >= 1L)

invisible(oldStack)
}
} ## plan_set()


## Main function
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions tests/multisession.R
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ stopifnot(v == yTruth)

message("*** multisession(..., workers = 1L) ... DONE")


message("*** multisession(..., gc = TRUE) ...")
plan(multisession, workers = 2L)

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit b25ac79

Please sign in to comment.