diff --git a/DESCRIPTION b/DESCRIPTION index e837cd63..1bf18c3a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: future -Version: 1.34.0-9107 +Version: 1.34.0-9109 Title: Unified Parallel and Distributed Processing in R for Everyone Imports: digest, diff --git a/R/Future-class.R b/R/Future-class.R index 2b6a8838..f3aed246 100644 --- a/R/Future-class.R +++ b/R/Future-class.R @@ -662,9 +662,10 @@ getExpression.Future <- local({ future:::evalFuture(core = .(core), capture = .(capture), context = .(context), split = .(split), immediateConditionClasses = .(immediateConditionClasses), forwardOptions = .(forwardOptions), local = .(local), cleanup = .(cleanup)) }) - function(future, expr = future$expr, immediateConditions = FALSE, threads = NA_integer_, cleanup = TRUE, ...) { + function(future, expr = future$expr, immediateConditions = FALSE, threads = NA_integer_, ..., cleanup = TRUE) { debug <- getOption("future.debug", FALSE) ## mdebug("getExpression() ...") + args <- list(...) local <- future$local split <- future$split @@ -710,9 +711,11 @@ getExpression.Future <- local({ } ## Create a future core + globals <- args$globals + if (is.null(globals)) globals <- globals(future) core <- list( expr = expr, - globals = globals(future), + globals = globals, packages = pkgs, seed = future$seed ) @@ -770,7 +773,7 @@ getExpression.Future <- local({ width = getOption("width") ) - mc.cores <- list(...)$mc.cores + mc.cores <- args$mc.cores if (!is.null(mc.cores)) { forwardOptions$mc.cores <- mc.cores } diff --git a/R/MulticoreFuture-class.R b/R/MulticoreFuture-class.R index 25965b25..a1496a2b 100644 --- a/R/MulticoreFuture-class.R +++ b/R/MulticoreFuture-class.R @@ -48,15 +48,16 @@ run.MulticoreFuture <- function(future, ...) { mcparallel <- importParallel("mcparallel") - expr <- getExpression(future) + expr <- getExpression(future, globals = list()) envir <- future$envir + envir <- new.env(parent = envir) t_start <- Sys.time() ## Assign globals - envir <- new.env(parent = envir) - if (length(future$globals) > 0L) { - envir <- assign_globals(envir, globals = future$globals) + globals <- future$globals + if (length(globals) > 0L) { + envir <- assign_globals(envir, globals = globals) } ## Get a free worker diff --git a/R/UniprocessFuture-class.R b/R/UniprocessFuture-class.R index 0c7a532a..81118791 100644 --- a/R/UniprocessFuture-class.R +++ b/R/UniprocessFuture-class.R @@ -33,7 +33,7 @@ run.UniprocessFuture <- function(future, ...) { ## also the one that evaluates/resolves/queries it. assertOwner(future) - expr <- getExpression(future) + expr <- getExpression(future, globals = list()) envir <- future$envir envir <- new.env(parent = envir)