Skip to content

Commit bcfc878

Browse files
Merge branch 'feature/FutureBackend' of github.com:HenrikBengtsson/future into feature/FutureBackend
2 parents 8188aa6 + 4bcca61 commit bcfc878

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed

R/backend_api-ClusterRegistry.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ ClusterRegistry <- local({
4747

4848
.makeCluster <- function(workers, ...) {
4949
if (length(workers) == 0L) return(NULL)
50+
oenv <- Sys.getenv("R_FUTURE_PLAN", NA_character_)
51+
Sys.unsetenv("R_FUTURE_PLAN")
52+
on.exit({
53+
if (!is.na(oenv)) Sys.setenv(R_FUTURE_PLAN = oenv)
54+
})
5055
cl <- makeClusterPSOCK(workers, ...)
5156
cl <- addCovrLibPath(cl)
5257
cl

R/backend_api-Future-class.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,7 @@ getFutureContext <- function(future, mc.cores = NULL, local = TRUE, ..., debug =
783783
## Use default future strategy + identify packages needed by the backend
784784
if (length(strategiesR) == 0L) {
785785
if (debug) mdebug("Packages needed by future strategies (n = 0): <none>")
786-
strategiesR <- getOption("future.plan")
787-
if (is.null(strategiesR)) strategiesR <- sequential
786+
strategiesR <- sequential
788787
backendPackages <- c("future")
789788
} else {
790789
## Identify package namespaces needed for strategies

R/zzz.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ attr(multicore, "backend") <- MulticoreFutureBackend
2020
update_package_option("future.debug", mode = "logical")
2121
debug <- isTRUE(getOption("future.debug"))
2222

23+
## Special case: Disable 'R_FUTURE_PLAN' when 'R CMD check'
24+
## runs checks on examples, because, for instance,
25+
## R_FUTURE_PLAN=multisession, will create connections that
26+
## the check code will think are left over connections.
27+
if (!is.na(Sys.getenv("R_FUTURE_PLAN")) && "CheckExEnv" %in% search()) {
28+
Sys.unsetenv("R_FUTURE_PLAN")
29+
}
30+
2331
if (debug) {
2432
envs <- Sys.getenv()
2533
envs <- envs[grep("R_FUTURE_", names(envs), fixed = TRUE)]

tests/cluster,worker-termination.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ message("Library paths: ", commaq(.libPaths()))
1414
message("Package path: ", sQuote(system.file(package = "future")))
1515
message("TMPDIR for parallel workers: ", sQuote(Sys.getenv("TMPDIR")))
1616

17-
types <- "PSOCK"
18-
17+
types <- NULL
18+
if (!covr_testing) types <- c(types, "PSOCK")
1919
if (supportsMulticore()) types <- c(types, "FORK")
2020

2121
pid <- Sys.getpid()

tests/cluster-missing-future-pkg.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ message("*** cluster() ...")
66
message("Library paths: ", commaq(.libPaths()))
77
message("Package path: ", sQuote(system.file(package = "future")))
88

9-
types <- "PSOCK"
10-
9+
types <- NULL
10+
if (!covr_testing) types <- c(types, "PSOCK")
1111
if (supportsMulticore()) types <- c(types, "FORK")
1212

1313
setupClusterWithoutPkgs <- function(type = "PSOCK", withouts = c("future")) {

0 commit comments

Comments
 (0)