Last updated on 2018-09-26 01:46:22 CEST.
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
---|---|---|---|---|---|---|
r-devel-linux-x86_64-debian-clang | 0.6.0 | 1.22 | 47.74 | 48.96 | OK | |
r-devel-linux-x86_64-debian-gcc | 0.6.0 | 1.06 | 38.31 | 39.37 | OK | |
r-devel-linux-x86_64-fedora-clang | 0.6.0 | 59.29 | OK | |||
r-devel-linux-x86_64-fedora-gcc | 0.6.0 | 57.10 | OK | |||
r-devel-windows-ix86+x86_64 | 0.6.0 | 4.00 | 138.00 | 142.00 | OK | |
r-patched-linux-x86_64 | 0.6.0 | 1.41 | 45.56 | 46.97 | OK | |
r-patched-solaris-x86 | 0.6.0 | 133.60 | ERROR | |||
r-release-linux-x86_64 | 0.6.0 | 1.39 | 45.78 | 47.17 | OK | |
r-release-windows-ix86+x86_64 | 0.6.0 | 3.00 | 140.00 | 143.00 | OK | |
r-release-osx-x86_64 | 0.6.0 | OK | ||||
r-oldrel-windows-ix86+x86_64 | 0.6.0 | 4.00 | 138.00 | 142.00 | OK | |
r-oldrel-osx-x86_64 | 0.6.0 | OK |
Version: 0.6.0
Check: tests
Result: ERROR
Running ‘DEPRECATED.R’
Running ‘doRNG,dopar.R’
Running ‘doRNG,dorng.R’
Running ‘foreach,errors.R’ [14s/12s]
Running ‘foreach,globals.R’
Running ‘foreach,nested.R’ [18s/15s]
Running ‘foreach,nested_dopar.R’ [25s/20s]
Running ‘foreach.R’
Running ‘future.BatchJobs.R’
Running ‘future.batchtools.R’
Running ‘options.R’
Running ‘registerDoFuture.R’
Running ‘times.R’
Running ‘zzz_opt-in,NMF.R’
Running ‘zzz_opt-in,TSP.R’
Running ‘zzz_opt-in,caret.R’
Running ‘zzz_opt-in,foreach.R’
Running ‘zzz_opt-in,glmnet.R’
Running ‘zzz_opt-in,plyr.R’
Running the tests in ‘tests/foreach,nested_dopar.R’ failed.
Complete output:
> source("incl/start.R")
Loading required package: future
Loading required package: foreach
Loading required package: iterators
Loading required package: parallel
plan(): nbrOfWorkers() = 1
>
> strategies <- future:::supportedStrategies()
> strategies <- setdiff(strategies, "multiprocess")
>
> message("*** doFuture - nested %dopar% ...")
*** doFuture - nested %dopar% ...
>
> registerDoFuture()
>
> message("*** doFuture - nested %dopar% and tricky globals ...")
*** doFuture - nested %dopar% and tricky globals ...
>
> ## This works ...
> x <- foreach(j = 1) %dopar% { j }
doFuture() ...
- dummy globals (as locals): [1] 'j'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
j <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
j
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Searching for globals ...
- globals found: [14] '{', '::', 'lapply', 'seq_along', '...future.x_ii', '<-', '[[', 'environment', 'local', 'for', 'names', 'assign', 'tryCatch', 'identity'
Searching for globals ... DONE
Resolving globals: FALSE
The total size of the 1 globals is 0 bytes (0 bytes)
- globals: [1] '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [1] '...future.x_ii'
List of 1
$ ...future.x_ii: NULL
- attr(*, "where")=List of 1
..$ ...future.x_ii:<environment: 8a23988>
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 0
- packages: [0]
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
j <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
j
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 1
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
Chunk #1 of 1 ...
getGlobalsAndPackages() ...
- globals passed as-is: [1] '...future.x_ii'
Resolving globals: FALSE
The total size of the 1 globals is 36 bytes (36 bytes)
- globals: [1] '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = NULL,
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
j <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
j
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
plan(): nbrOfWorkers() = 1
SequentialFuture started (and completed)
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 1
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
> str(x)
List of 1
$ : num 1
> rm(list = "x")
>
> ## ... but this would give a "globals-not-found" error in
> ## doFuture (<= 0.4.0) because 'j' was interpreted as global variable
> x <- foreach(i = 1, .packages = "foreach") %dopar% {
+ foreach(j = 1) %dopar% { j }
+ }
doFuture() ...
- dummy globals (as locals): [1] 'i'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
i <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
foreach(j = 1) %dopar% {
j
}
}
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Searching for globals ...
- globals found: [18] '{', '::', 'lapply', 'seq_along', '...future.x_ii', '<-', '[[', 'environment', 'local', 'for', 'names', 'assign', 'tryCatch', 'library', '%dopar%', 'foreach', 'j', 'identity'
Searching for globals ... DONE
Resolving globals: FALSE
The total size of the 1 globals is 0 bytes (0 bytes)
- globals: [1] '...future.x_ii'
- packages: [1] 'foreach'
getGlobalsAndPackages() ... DONE
- globals: [1] '...future.x_ii'
List of 1
$ ...future.x_ii: NULL
- attr(*, "where")=List of 1
..$ ...future.x_ii:<environment: a2000f0>
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 0
- packages: [1] 'foreach'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
i <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
foreach(j = 1) %dopar% {
j
}
}
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 1
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
Chunk #1 of 1 ...
getGlobalsAndPackages() ...
- globals passed as-is: [1] '...future.x_ii'
Resolving globals: FALSE
The total size of the 1 globals is 36 bytes (36 bytes)
- globals: [1] '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
local({
for (pkg in "foreach") {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
i <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
foreach(j = 1) %dopar% {
j
}
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
plan(): nbrOfWorkers() = 1
doFuture() ...
- dummy globals (as locals): [1] 'j'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
j <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
j
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Searching for globals ...
- globals found: [14] '{', '::', 'lapply', 'seq_along', '...future.x_ii', '<-', '[[', 'environment', 'local', 'for', 'names', 'assign', 'tryCatch', 'identity'
Searching for globals ... DONE
Resolving globals: FALSE
The total size of the 1 globals is 0 bytes (0 bytes)
- globals: [1] '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [1] '...future.x_ii'
List of 1
$ ...future.x_ii: NULL
- attr(*, "where")=List of 1
..$ ...future.x_ii:<environment: 9437e70>
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 0
- packages: [0]
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
j <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
j
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 1
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
Chunk #1 of 1 ...
getGlobalsAndPackages() ...
- globals passed as-is: [1] '...future.x_ii'
Resolving globals: FALSE
The total size of the 1 globals is 36 bytes (36 bytes)
- globals: [1] '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
plan(): nbrOfWorkers() = 1
SequentialFuture started (and completed)
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 1
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
SequentialFuture started (and completed)
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 1
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
j <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
j
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
> str(x)
List of 1
$ :List of 1
..$ : num 1
> rm(list = "x")
>
> message("*** doFuture - nested %dopar% and tricky globals ... DONE")
*** doFuture - nested %dopar% and tricky globals ... DONE
>
>
> for (strategy1 in strategies) {
+ for (strategy2 in strategies) {
+ message(sprintf("- plan(list('%s', '%s')) ...", strategy1, strategy2))
+ plan(list(a = strategy1, b = strategy2))
+ nested <- plan("list")
+
+ as <- 1:2
+ bs <- 3:1
+
+ stopifnot(!exists("a", inherits = FALSE), !exists("b", inherits = FALSE))
+
+ message("foreach() - level 1 ...")
+ x <- foreach(a = as, .export = c("bs", "strategy2"),
+ .packages = "foreach") %dopar% {
+ plan <- future::plan()
+ stopifnot(inherits(plan, strategy2))
+ plan_a <- future::plan("list")
+ str(plan_a)
+ stopifnot(inherits(plan_a[[1]], strategy2))
+
+ message("foreach() - level 2 ...")
+ y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar% {
+ plan <- future::plan()
+ message(capture.output(print(plan)))
+ stopifnot(
+ inherits(plan, "future"),
+ inherits(plan, getOption("future.default", "sequential"))
+ )
+
+ plan_b <- future::plan("list")
+ str(plan_b)
+ stopifnot(
+ inherits(plan_b[[1]], "future"),
+ inherits(plan_b[[1]], getOption("future.default", "sequential"))
+ )
+
+ list(a = a, plan_a = plan_a,
+ b = b, plan_b = plan_b)
+ }
+ message("foreach() - level 2 ... DONE")
+
+ y
+ }
+ message("foreach() - level 1 ... DONE")
+
+ local({
+ stopifnot(length(x) == length(as))
+ for (aa in seq_along(as)) {
+ x_aa <- x[[aa]]
+ stopifnot(length(x_aa) == length(bs))
+ a <- as[aa]
+ for (bb in seq_along(bs)) {
+ x_aa_bb <- x_aa[[bb]]
+ b <- bs[bb]
+ stopifnot(
+ length(x_aa_bb) == 4L,
+ all(names(x_aa_bb) == c("a", "plan_a", "b", "plan_b")),
+ x_aa_bb$a == a,
+ x_aa_bb$b == b,
+ inherits(x_aa_bb$plan_a[[1]], strategy2),
+ inherits(x_aa_bb$plan_b[[1]], "future"),
+ inherits(x_aa_bb$plan_b[[1]],
+ getOption("future.default", "sequential"))
+ )
+ }
+ }
+ })
+
+ ## Cleanup in order make sure none of these variables exist as
+ ## proxies for missing globals of the name names
+ rm(list = c("as", "bs", "x"))
+ message(sprintf("- plan(list('%s', '%s')) ... DONE", strategy1, strategy2))
+ }
+ }
- plan(list('sequential', 'sequential')) ...
plan(): nbrOfWorkers() = 1
foreach() - level 1 ...
doFuture() ...
- dummy globals (as locals): [1] 'a'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 124 bytes (124 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
List of 3
$ bs : int [1:3] 3 2 1
$ strategy2 : chr "sequential"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ bs :<environment: R_GlobalEnv>
..$ strategy2 :<environment: R_GlobalEnv>
..$ ...future.x_ii:<environment: a0ff928>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 124
- packages: [1] 'foreach'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 1
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
Chunk #1 of 1 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 196 bytes (196 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
foreach() - level 2 ...
doFuture() ...
- dummy globals (as locals): [1] 'b'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 22.75 KiB (23300 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
List of 3
$ a : int 1
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
.. ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: 9638568>
..$ plan_a :<environment: 9638568>
..$ ...future.x_ii:<environment: 8e96a80>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 23300
- packages: [0]
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 1
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
Chunk #1 of 1 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 22.86 KiB (23408 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
plan(): nbrOfWorkers() = 1
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
SequentialFuture started (and completed)
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 1
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
foreach() - level 2 ...
doFuture() ...
- dummy globals (as locals): [1] 'b'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 22.75 KiB (23300 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
List of 3
$ a : int 2
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
.. ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: a0083a8>
..$ plan_a :<environment: a0083a8>
..$ ...future.x_ii:<environment: 988ea68>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 23300
- packages: [0]
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 1
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
Chunk #1 of 1 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 22.86 KiB (23408 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
plan(): nbrOfWorkers() = 1
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
SequentialFuture started (and completed)
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 1
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
SequentialFuture started (and completed)
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 1
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 1 ... DONE
- plan(list('sequential', 'sequential')) ... DONE
- plan(list('sequential', 'multicore')) ...
plan(): nbrOfWorkers() = 1
foreach() - level 1 ...
doFuture() ...
- dummy globals (as locals): [1] 'a'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 124 bytes (124 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
List of 3
$ bs : int [1:3] 3 2 1
$ strategy2 : chr "multicore"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ bs :<environment: R_GlobalEnv>
..$ strategy2 :<environment: R_GlobalEnv>
..$ ...future.x_ii:<environment: 93a69b0>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 124
- packages: [1] 'foreach'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 1
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
Chunk #1 of 1 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 196 bytes (196 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >= 1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
foreach() - level 2 ...
doFuture() ...
- dummy globals (as locals): [1] 'b'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 41.91 KiB (42920 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
List of 3
$ a : int 1
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
.. ..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: 8affe28>
..$ plan_a :<environment: 8affe28>
..$ ...future.x_ii:<environment: 9532cd0>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 42920
- packages: [0]
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 41.95 KiB (42956 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
requestCore(): workers = 2
MulticoreFuture started
Chunk #1 of 2 ... DONE
Chunk #2 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 41.98 KiB (42992 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
plan(): nbrOfWorkers() = 1
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
requestCore(): workers = 2
MulticoreFuture started
Chunk #2 of 2 ... DONE
Launching 2 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 2
length: 1 (resolved future 1)
plan(): nbrOfWorkers() = 1
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
length: 0 (resolved future 2)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
foreach() - level 2 ...
doFuture() ...
- dummy globals (as locals): [1] 'b'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 41.91 KiB (42920 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
List of 3
$ a : int 2
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
.. ..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: 981cd68>
..$ plan_a :<environment: 981cd68>
..$ ...future.x_ii:<environment: 8ee9008>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 42920
- packages: [0]
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 41.95 KiB (42956 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
requestCore(): workers = 2
MulticoreFuture started
Chunk #1 of 2 ... DONE
Chunk #2 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 41.98 KiB (42992 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
plan(): nbrOfWorkers() = 1
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
requestCore(): workers = 2
MulticoreFuture started
Chunk #2 of 2 ... DONE
Launching 2 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 2
length: 1 (resolved future 1)
plan(): nbrOfWorkers() = 1
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
length: 0 (resolved future 2)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
SequentialFuture started (and completed)
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 1
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 1 ... DONE
- plan(list('sequential', 'multicore')) ... DONE
- plan(list('sequential', 'multisession')) ...
plan(): nbrOfWorkers() = 1
foreach() - level 1 ...
doFuture() ...
- dummy globals (as locals): [1] 'a'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 124 bytes (124 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
List of 3
$ bs : int [1:3] 3 2 1
$ strategy2 : chr "multisession"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ bs :<environment: R_GlobalEnv>
..$ strategy2 :<environment: R_GlobalEnv>
..$ ...future.x_ii:<environment: 9844be8>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 124
- packages: [1] 'foreach'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 1
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
Chunk #1 of 1 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 196 bytes (196 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
foreach() - level 2 ...
doFuture() ...
- dummy globals (as locals): [1] 'b'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 46.34 KiB (47456 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
List of 3
$ a : int 1
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL, ...)
.. ..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
.. ..- attr(*, "init")= logi TRUE
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: 9b42a30>
..$ plan_a :<environment: 9b42a30>
..$ ...future.x_ii:<environment: 9c49050>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 47456
- packages: [0]
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
Workers: [n = 2] 'localhost', 'localhost'
Base port: 11712
Creating node 1 of 2 ...
- setting up node
Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11712 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #1 on 'localhost' to connect back
Connection with worker #1 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 1 of 2 ... done
Creating node 2 of 2 ...
- setting up node
Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11712 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #2 on 'localhost' to connect back
Connection with worker #2 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 2 of 2 ... done
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 46.38 KiB (47492 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
Exporting 3 global objects (46.38 KiB) to cluster node #1 ...
Exporting 'a' (36 bytes) to cluster node #1 ...
Exporting 'a' (36 bytes) to cluster node #1 ... DONE
Exporting 'plan_a' (46.31 KiB) to cluster node #1 ...
Exporting 'plan_a' (46.31 KiB) to cluster node #1 ... DONE
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
Exporting 3 global objects (46.38 KiB) to cluster node #1 ... DONE
MultisessionFuture started
Chunk #1 of 2 ... DONE
Chunk #2 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 46.41 KiB (47528 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
Exporting 3 global objects (46.41 KiB) to cluster node #2 ...
Exporting 'a' (36 bytes) to cluster node #2 ...
Exporting 'a' (36 bytes) to cluster node #2 ... DONE
Exporting 'plan_a' (46.31 KiB) to cluster node #2 ...
Exporting 'plan_a' (46.31 KiB) to cluster node #2 ... DONE
Exporting '...future.x_ii' (72 bytes) to cluster node #2 ...
Exporting '...future.x_ii' (72 bytes) to cluster node #2 ... DONE
Exporting 3 global objects (46.41 KiB) to cluster node #2 ... DONE
MultisessionFuture started
Chunk #2 of 2 ... DONE
Launching 2 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 2
length: 1 (resolved future 1)
length: 0 (resolved future 2)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
foreach() - level 2 ...
doFuture() ...
- dummy globals (as locals): [1] 'b'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 46.34 KiB (47456 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
List of 3
$ a : int 2
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL, ...)
.. ..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
.. ..- attr(*, "init")= logi TRUE
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: 9b418a0>
..$ plan_a :<environment: 9b418a0>
..$ ...future.x_ii:<environment: 9c49500>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 47456
- packages: [0]
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 46.38 KiB (47492 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
Exporting 3 global objects (46.38 KiB) to cluster node #1 ...
Exporting 'a' (36 bytes) to cluster node #1 ...
Exporting 'a' (36 bytes) to cluster node #1 ... DONE
Exporting 'plan_a' (46.31 KiB) to cluster node #1 ...
Exporting 'plan_a' (46.31 KiB) to cluster node #1 ... DONE
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
Exporting 3 global objects (46.38 KiB) to cluster node #1 ... DONE
MultisessionFuture started
Chunk #1 of 2 ... DONE
Chunk #2 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 46.41 KiB (47528 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
Exporting 3 global objects (46.41 KiB) to cluster node #2 ...
Exporting 'a' (36 bytes) to cluster node #2 ...
Exporting 'a' (36 bytes) to cluster node #2 ... DONE
Exporting 'plan_a' (46.31 KiB) to cluster node #2 ...
Exporting 'plan_a' (46.31 KiB) to cluster node #2 ... DONE
Exporting '...future.x_ii' (72 bytes) to cluster node #2 ...
Exporting '...future.x_ii' (72 bytes) to cluster node #2 ... DONE
Exporting 3 global objects (46.41 KiB) to cluster node #2 ... DONE
MultisessionFuture started
Chunk #2 of 2 ... DONE
Launching 2 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 2
length: 1 (resolved future 1)
length: 0 (resolved future 2)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
SequentialFuture started (and completed)
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 1
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL, ...)
..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
..- attr(*, "init")= logi TRUE
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL, ...)
..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
..- attr(*, "init")= logi TRUE
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 1 ... DONE
- plan(list('sequential', 'multisession')) ... DONE
- plan(list('sequential', 'cluster')) ...
plan(): nbrOfWorkers() = 1
foreach() - level 1 ...
doFuture() ...
- dummy globals (as locals): [1] 'a'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 116 bytes (116 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
List of 3
$ bs : int [1:3] 3 2 1
$ strategy2 : chr "cluster"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ bs :<environment: R_GlobalEnv>
..$ strategy2 :<environment: R_GlobalEnv>
..$ ...future.x_ii:<environment: 9c47e50>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 116
- packages: [1] 'foreach'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 1
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
Chunk #1 of 1 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 188 bytes (188 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
foreach() - level 2 ...
doFuture() ...
- dummy globals (as locals): [1] 'b'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 36.93 KiB (37820 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
List of 3
$ a : int 1
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE,
label = NULL, ...)
.. ..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
.. ..- attr(*, "init")= logi TRUE
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: 936ee50>
..$ plan_a :<environment: 936ee50>
..$ ...future.x_ii:<environment: 8cadb18>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 37820
- packages: [0]
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
Workers: [n = 2] 'localhost', 'localhost'
Base port: 11997
Creating node 1 of 2 ...
- setting up node
Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11997 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #1 on 'localhost' to connect back
Connection with worker #1 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 1 of 2 ... done
Creating node 2 of 2 ...
- setting up node
Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11997 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #2 on 'localhost' to connect back
Connection with worker #2 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 2 of 2 ... done
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 36.97 KiB (37856 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
Exporting 3 global objects (36.97 KiB) to cluster node #1 ...
Exporting 'a' (36 bytes) to cluster node #1 ...
Exporting 'a' (36 bytes) to cluster node #1 ... DONE
Exporting 'plan_a' (36.90 KiB) to cluster node #1 ...
Exporting 'plan_a' (36.90 KiB) to cluster node #1 ... DONE
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
Exporting 3 global objects (36.97 KiB) to cluster node #1 ... DONE
ClusterFuture started
Chunk #1 of 2 ... DONE
Chunk #2 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 37.00 KiB (37892 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
Exporting 3 global objects (37.00 KiB) to cluster node #2 ...
Exporting 'a' (36 bytes) to cluster node #2 ...
Exporting 'a' (36 bytes) to cluster node #2 ... DONE
Exporting 'plan_a' (36.90 KiB) to cluster node #2 ...
Exporting 'plan_a' (36.90 KiB) to cluster node #2 ... DONE
Exporting '...future.x_ii' (72 bytes) to cluster node #2 ...
Exporting '...future.x_ii' (72 bytes) to cluster node #2 ... DONE
Exporting 3 global objects (37.00 KiB) to cluster node #2 ... DONE
ClusterFuture started
Chunk #2 of 2 ... DONE
Launching 2 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 2
length: 1 (resolved future 1)
length: 0 (resolved future 2)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
foreach() - level 2 ...
doFuture() ...
- dummy globals (as locals): [1] 'b'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 36.93 KiB (37820 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
List of 3
$ a : int 2
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE,
label = NULL, ...)
.. ..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
.. ..- attr(*, "init")= logi TRUE
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: 8e4eb20>
..$ plan_a :<environment: 8e4eb20>
..$ ...future.x_ii:<environment: 8c8aba8>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 37820
- packages: [0]
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 36.97 KiB (37856 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
Exporting 3 global objects (36.97 KiB) to cluster node #1 ...
Exporting 'a' (36 bytes) to cluster node #1 ...
Exporting 'a' (36 bytes) to cluster node #1 ... DONE
Exporting 'plan_a' (36.90 KiB) to cluster node #1 ...
Exporting 'plan_a' (36.90 KiB) to cluster node #1 ... DONE
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
Exporting 3 global objects (36.97 KiB) to cluster node #1 ... DONE
ClusterFuture started
Chunk #1 of 2 ... DONE
Chunk #2 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 37.00 KiB (37892 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
Exporting 3 global objects (37.00 KiB) to cluster node #2 ...
Exporting 'a' (36 bytes) to cluster node #2 ...
Exporting 'a' (36 bytes) to cluster node #2 ... DONE
Exporting 'plan_a' (36.90 KiB) to cluster node #2 ...
Exporting 'plan_a' (36.90 KiB) to cluster node #2 ... DONE
Exporting '...future.x_ii' (72 bytes) to cluster node #2 ...
Exporting '...future.x_ii' (72 bytes) to cluster node #2 ... DONE
Exporting 3 global objects (37.00 KiB) to cluster node #2 ... DONE
ClusterFuture started
Chunk #2 of 2 ... DONE
Launching 2 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 2
length: 1 (resolved future 1)
length: 0 (resolved future 2)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
SequentialFuture started (and completed)
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 1
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE,
label = NULL, ...)
..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
..- attr(*, "init")= logi TRUE
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE,
label = NULL, ...)
..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
..- attr(*, "init")= logi TRUE
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 1 ... DONE
- plan(list('sequential', 'cluster')) ... DONE
- plan(list('multicore', 'sequential')) ...
plan(): nbrOfWorkers() = 2
foreach() - level 1 ...
doFuture() ...
- dummy globals (as locals): [1] 'a'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 124 bytes (124 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
List of 3
$ bs : int [1:3] 3 2 1
$ strategy2 : chr "sequential"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ bs :<environment: R_GlobalEnv>
..$ strategy2 :<environment: R_GlobalEnv>
..$ ...future.x_ii:<environment: 8c67678>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 124
- packages: [1] 'foreach'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 160 bytes (160 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
requestCore(): workers = 2
MulticoreFuture started
Chunk #1 of 2 ... DONE
Chunk #2 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 160 bytes (160 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
foreach() - level 2 ...
zy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
requestCore(): workers = 2
doFuture() ...
- dummy globals (as locals): [1] 'b'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
MulticoreFuture started
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
Retrieving globals ... DONE
Chunk #2 of 2 ... DONE
Resolving globals: FALSE
Launching 2 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 2
The total size of the 3 globals is 22.75 KiB (23300 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
foreach() - level 2 ...
doFuture() ...
- dummy globals (as locals): [1] 'b'
List of 3
$ a : int 1
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
.. ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: 9cb4390>
..$ plan_a :<environment: 9cb4390>
..$ ...future.x_ii:<environment: a2285e0>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 23300
- packages: [0]
- R expression:
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ... DONE
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ...
Number of chunks: 1
getGlobalsAndPackages() ...
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
Retrieving globals ...
Chunk #1 of 1 ...
getGlobalsAndPackages() ...
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
Resolving globals: FALSE
The total size of the 3 globals is 22.86 KiB (23408 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
The total size of the 3 globals is 22.75 KiB (23300 bytes)
getGlobalsAndPackages() ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
plan(): nbrOfWorkers() = 1
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
List of 3
$ a : int 2
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
.. ..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: a2a4880>
..$ plan_a :<environment: a2a4880>
..$ ...future.x_ii:<environment: 96dc738>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 23300
- packages: [0]
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 1
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
Chunk #1 of 1 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 22.86 KiB (23408 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
SequentialFuture started (and completed)
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
- resolving future
resolve() on list ...
Packages needed by future strategies (n = 0): <none>
recursive: 0
Packages needed by the future expression (n = 0): <none>
length: 1
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
plan(): nbrOfWorkers() = 1
length: 1 (resolved future 1)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
SequentialFuture started (and completed)
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 1
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
length: 0 (resolved future 2)
resolve() on list ... DONE
- collecting values of future
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 1 ... DONE
- plan(list('multicore', 'sequential')) ... DONE
- plan(list('multicore', 'multicore')) ...
plan(): nbrOfWorkers() = 2
foreach() - level 1 ...
doFuture() ...
- dummy globals (as locals): [1] 'a'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 124 bytes (124 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
List of 3
$ bs : int [1:3] 3 2 1
$ strategy2 : chr "multicore"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ bs :<environment: R_GlobalEnv>
..$ strategy2 :<environment: R_GlobalEnv>
..$ ...future.x_ii:<environment: 8fabfa8>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 124
- packages: [1] 'foreach'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 160 bytes (160 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >= 1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
requestCore(): workers = 2
MulticoreFuture started
Chunk #1 of 2 ... DONE
Chunk #2 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 160 bytes (160 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >= 1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
foreach() - level 2 ...
s = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
requestCore(): workers = 2
doFuture() ...
- dummy globals (as locals): [1] 'b'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
MulticoreFuture started
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
Chunk #2 of 2 ... DONE
Retrieving globals ... DONE
Launching 2 futures (chunks) ... DONE
- resolving future
Resolving globals: FALSE
resolve() on list ...
recursive: 0
length: 2
The total size of the 3 globals is 41.91 KiB (42920 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
foreach() - level 2 ...
doFuture() ...
List of 3
$ a : int 1
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
.. ..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: 9af5b50>
..$ plan_a :<environment: 9af5b50>
..$ ...future.x_ii:<environment: 9c0d6d8>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 42920
- packages: [0]
- R expression:
- dummy globals (as locals): [1] 'b'
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- R expression:
- identifying globals and packages ... DONE
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
Number of chunks: 1
- identifying globals and packages ...
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
getGlobalsAndPackages() ...
Chunk #1 of 1 ...
Retrieving globals ...
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 41.91 KiB (42920 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 42.02 KiB (43028 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
plan(): nbrOfWorkers() = 1
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
List of 3
$ a : int 2
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
.. ..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: 9c37f58>
..$ plan_a :<environment: 9c37f58>
..$ ...future.x_ii:<environment: a1914e0>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 42920
- packages: [0]
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ... DONE
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
Number of chunks: 1
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
Chunk #1 of 1 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
The total size of the 3 globals is 42.02 KiB (43028 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
SequentialFuture started (and completed)
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
Packages needed by future strategies (n = 0): <none>
- resolving future
Packages needed by the future expression (n = 0): <none>
resolve() on list ...
recursive: 0
length: 1
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
plan(): nbrOfWorkers() = 1
length: 1 (resolved future 1)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
SequentialFuture started (and completed)
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 1
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
length: 0 (resolved future 2)
resolve() on list ... DONE
- collecting values of future
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 1 ... DONE
- plan(list('multicore', 'multicore')) ... DONE
- plan(list('multicore', 'multisession')) ...
plan(): nbrOfWorkers() = 2
foreach() - level 1 ...
doFuture() ...
- dummy globals (as locals): [1] 'a'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 124 bytes (124 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
List of 3
$ bs : int [1:3] 3 2 1
$ strategy2 : chr "multisession"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ bs :<environment: R_GlobalEnv>
..$ strategy2 :<environment: R_GlobalEnv>
..$ ...future.x_ii:<environment: a2bb9f8>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 124
- packages: [1] 'foreach'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 160 bytes (160 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
requestCore(): workers = 2
MulticoreFuture started
Chunk #1 of 2 ... DONE
Chunk #2 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 160 bytes (160 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
foreach() - level 2 ...
kg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
doFuture() ...
requestCore(): workers = 2
- dummy globals (as locals): [1] 'b'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
MulticoreFuture started
Retrieving globals ... DONE
Chunk #2 of 2 ... DONE
Resolving globals: FALSE
Launching 2 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 2
The total size of the 3 globals is 46.34 KiB (47456 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
foreach() - level 2 ...
doFuture() ...
List of 3
$ a : int 1
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL, ...)
.. ..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
.. ..- attr(*, "init")= logi TRUE
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: 9311bc0>
..$ plan_a :<environment: 9311bc0>
..$ ...future.x_ii:<environment: 92087f0>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 47456
- packages: [0]
- R expression:
- dummy globals (as locals): [1] 'b'
- identifying globals and packages ... DONE
- R expression:
Number of chunks: 1
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
Chunk #1 of 1 ...
- identifying globals and packages ...
getGlobalsAndPackages() ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 46.45 KiB (47564 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
The total size of the 3 globals is 46.34 KiB (47456 bytes)
Chunk #1 of 1 ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- resolving future
resolve() on list ...
- globals: [3] 'a', 'plan_a', '...future.x_ii'
recursive: 0
length: 1
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
List of 3
$ a : int 2
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL, ...)
.. ..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
.. ..- attr(*, "init")= logi TRUE
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: 9222a68>
..$ plan_a :<environment: 9222a68>
..$ ...future.x_ii:<environment: 9bc5218>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 47456
- packages: [0]
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 1
plan(): nbrOfWorkers() = 1
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
Chunk #1 of 1 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
Resolving globals: FALSE
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
SequentialFuture started (and completed)
length: 1
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
- accumulating results
Packages needed by future strategies (n = 0): <none>
- processing errors (handler = 'stop')
Packages needed by the future expression (n = 0): <none>
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
length: 1 (resolved future 1)
plan(): nbrOfWorkers() = 1
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
sequential:- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL, ...)- tweaked: FALSE- call: future::plan("default", .cleanup = FALSE, .init = FALSE)
SequentialFuture started (and completed)
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
length: 0 (resolved future 2)
resolve() on list ... DONE
- collecting values of future
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL, ...)
..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
..- attr(*, "init")= logi TRUE
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL, ...)
..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
..- attr(*, "init")= logi TRUE
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 1 ... DONE
- plan(list('multicore', 'multisession')) ... DONE
- plan(list('multicore', 'cluster')) ...
plan(): nbrOfWorkers() = 2
foreach() - level 1 ...
doFuture() ...
- dummy globals (as locals): [1] 'a'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 116 bytes (116 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
List of 3
$ bs : int [1:3] 3 2 1
$ strategy2 : chr "cluster"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ bs :<environment: R_GlobalEnv>
..$ strategy2 :<environment: R_GlobalEnv>
..$ ...future.x_ii:<environment: 9c793b0>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 116
- packages: [1] 'foreach'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 152 bytes (152 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
requestCore(): workers = 2
MulticoreFuture started
Chunk #1 of 2 ... DONE
Chunk #2 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 152 bytes (152 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
foreach() - level 2 ...
doFuture() ...
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
requestCore(): workers = 2
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
MulticoreFuture started
The total size of the 3 globals is 36.93 KiB (37820 bytes)
Chunk #2 of 2 ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
Launching 2 futures (chunks) ... DONE
- resolving future
getGlobalsAndPackages() ... DONE
resolve() on list ...
- globals: [3] 'a', 'plan_a', '...future.x_ii'
recursive: 0
length: 2
foreach() - level 2 ...
List of 3
$ a : int 1
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE,
label = NULL, ...)
.. ..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
.. ..- attr(*, "init")= logi TRUE
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: 8e39230>
..$ plan_a :<environment: 8e39230>
..$ ...future.x_ii:<environment: 8eba0e0>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 37820
- packages: [0]
- R expression:
doFuture() ...
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ... DONE
- dummy globals (as locals): [1] 'b'
Number of chunks: 1
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
- R expression:
Chunk #1 of 1 ...
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ...
Workers: [n = 1] 'localhost'
getGlobalsAndPackages() ...
Base port: 11266
Retrieving globals ...
Creating node 1 of 1 ...
- setting up node
- globals retrieved: [3] 'a', 'plan_a', '...future.x_ii'
Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11266 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 36.93 KiB (37820 bytes)
Waiting for worker #1 on 'localhost' to connect back
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'a', 'plan_a', '...future.x_ii'
List of 3
$ a : int 2
$ plan_a :List of 1
..$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE,
label = NULL, ...)
.. ..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
.. ..- attr(*, "init")= logi TRUE
.. ..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
..- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ a :<environment: 9704ce0>
..$ plan_a :<environment: 9704ce0>
..$ ...future.x_ii:<environment: 969e698>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 37820
- packages: [0]
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"), inherits(plan_b[[1]],
getOption("future.default", "sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 1
Number of futures (= number of chunks): 1
Launching 1 futures (chunks) ...
Chunk #1 of 1 ...
Workers: [n = 1] 'localhost'
Base port: 11081
Creating node 1 of 1 ...
- setting up node
Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11081 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #1 on 'localhost' to connect back
Connection with worker #1 on 'localhost' established
- assigning connection UUID
- collecting session information
Connection with worker #1 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 1 of 1 ... done
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 37.04 KiB (37928 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
Exporting 3 global objects (37.04 KiB) to cluster node #1 ...
Exporting 'a' (36 bytes) to cluster node #1 ...
Exporting 'a' (36 bytes) to cluster node #1 ... DONE
Exporting 'plan_a' (36.90 KiB) to cluster node #1 ...
Exporting 'plan_a' (36.90 KiB) to cluster node #1 ... DONE
Exporting '...future.x_ii' (108 bytes) to cluster node #1 ...
Exporting '...future.x_ii' (108 bytes) to cluster node #1 ... DONE
Exporting 3 global objects (37.04 KiB) to cluster node #1 ... DONE
ClusterFuture started
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 1
Creating node 1 of 1 ... done
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'a', 'plan_a', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 37.04 KiB (37928 bytes)
- globals: [3] 'a', 'plan_a', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 0): <none>
Packages needed by the future expression (n = 0): <none>
Exporting 3 global objects (37.04 KiB) to cluster node #1 ...
Exporting 'a' (36 bytes) to cluster node #1 ...
Exporting 'a' (36 bytes) to cluster node #1 ... DONE
Exporting 'plan_a' (36.90 KiB) to cluster node #1 ...
Exporting 'plan_a' (36.90 KiB) to cluster node #1 ... DONE
Exporting '...future.x_ii' (108 bytes) to cluster node #1 ...
Exporting '...future.x_ii' (108 bytes) to cluster node #1 ... DONE
Exporting 3 global objects (37.04 KiB) to cluster node #1 ... DONE
ClusterFuture started
Chunk #1 of 1 ... DONE
Launching 1 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 1
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
length: 1 (resolved future 1)
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 2 ... DONE
length: 0 (resolved future 2)
resolve() on list ... DONE
- collecting values of future
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE,
label = NULL, ...)
..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
..- attr(*, "init")= logi TRUE
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE,
label = NULL, ...)
..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
..- attr(*, "init")= logi TRUE
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ", "",
R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
future::plan("default", .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
b <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 1 ... DONE
- plan(list('multicore', 'cluster')) ... DONE
- plan(list('multisession', 'sequential')) ...
plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ...
multisession:
- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), gc = FALSE, earlySignal = FALSE, label = NULL, ...)
- tweaked: FALSE
- call: plan(list(a = strategy1, b = strategy2))
Workers: [n = 2] 'localhost', 'localhost'
Base port: 11569
Creating node 1 of 2 ...
- setting up node
Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11569 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #1 on 'localhost' to connect back
Connection with worker #1 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 1 of 2 ... done
Creating node 2 of 2 ...
- setting up node
Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11569 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #2 on 'localhost' to connect back
Connection with worker #2 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 2 of 2 ... done
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 0): <none>
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in "future") {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local(NA)
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
MultisessionFuture started
plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ... DONE
plan(): nbrOfWorkers() = 2
foreach() - level 1 ...
doFuture() ...
- dummy globals (as locals): [1] 'a'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 124 bytes (124 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
List of 3
$ bs : int [1:3] 3 2 1
$ strategy2 : chr "sequential"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ bs :<environment: R_GlobalEnv>
..$ strategy2 :<environment: R_GlobalEnv>
..$ ...future.x_ii:<environment: 9cde470>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 124
- packages: [1] 'foreach'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 160 bytes (160 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
Exporting 3 global objects (160 bytes) to cluster node #1 ...
Exporting 'bs' (44 bytes) to cluster node #1 ...
Exporting 'bs' (44 bytes) to cluster node #1 ... DONE
Exporting 'strategy2' (80 bytes) to cluster node #1 ...
Exporting 'strategy2' (80 bytes) to cluster node #1 ... DONE
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
Exporting 3 global objects (160 bytes) to cluster node #1 ... DONE
MultisessionFuture started
Chunk #1 of 2 ... DONE
Chunk #2 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 160 bytes (160 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
Exporting 3 global objects (160 bytes) to cluster node #2 ...
Exporting 'bs' (44 bytes) to cluster node #2 ...
Exporting 'bs' (44 bytes) to cluster node #2 ... DONE
Exporting 'strategy2' (80 bytes) to cluster node #2 ...
Exporting 'strategy2' (80 bytes) to cluster node #2 ... DONE
Exporting '...future.x_ii' (36 bytes) to cluster node #2 ...
Exporting '...future.x_ii' (36 bytes) to cluster node #2 ... DONE
Exporting 3 global objects (160 bytes) to cluster node #2 ... DONE
MultisessionFuture started
Chunk #2 of 2 ... DONE
Launching 2 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 2
length: 1 (resolved future 2)
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 1 ... DONE
- plan(list('multisession', 'sequential')) ... DONE
- plan(list('multisession', 'multicore')) ...
plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ...
multisession:
- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), gc = FALSE, earlySignal = FALSE, label = NULL, ...)
- tweaked: FALSE
- call: plan(list(a = strategy1, b = strategy2))
Workers: [n = 2] 'localhost', 'localhost'
Base port: 11430
Creating node 1 of 2 ...
- setting up node
Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11430 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #1 on 'localhost' to connect back
Connection with worker #1 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 1 of 2 ... done
Creating node 2 of 2 ...
- setting up node
Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11430 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #2 on 'localhost' to connect back
Connection with worker #2 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 2 of 2 ... done
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 0): <none>
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in "future") {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >= 1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local(NA)
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
MultisessionFuture started
plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ... DONE
plan(): nbrOfWorkers() = 2
foreach() - level 1 ...
doFuture() ...
- dummy globals (as locals): [1] 'a'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 124 bytes (124 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
List of 3
$ bs : int [1:3] 3 2 1
$ strategy2 : chr "multicore"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ bs :<environment: R_GlobalEnv>
..$ strategy2 :<environment: R_GlobalEnv>
..$ ...future.x_ii:<environment: a2e67a8>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 124
- packages: [1] 'foreach'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 160 bytes (160 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >= 1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
Exporting 3 global objects (160 bytes) to cluster node #1 ...
Exporting 'bs' (44 bytes) to cluster node #1 ...
Exporting 'bs' (44 bytes) to cluster node #1 ... DONE
Exporting 'strategy2' (80 bytes) to cluster node #1 ...
Exporting 'strategy2' (80 bytes) to cluster node #1 ... DONE
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
Exporting 3 global objects (160 bytes) to cluster node #1 ... DONE
MultisessionFuture started
Chunk #1 of 2 ... DONE
Chunk #2 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 160 bytes (160 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >= 1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
Exporting 3 global objects (160 bytes) to cluster node #2 ...
Exporting 'bs' (44 bytes) to cluster node #2 ...
Exporting 'bs' (44 bytes) to cluster node #2 ... DONE
Exporting 'strategy2' (80 bytes) to cluster node #2 ...
Exporting 'strategy2' (80 bytes) to cluster node #2 ... DONE
Exporting '...future.x_ii' (36 bytes) to cluster node #2 ...
Exporting '...future.x_ii' (36 bytes) to cluster node #2 ... DONE
Exporting 3 global objects (160 bytes) to cluster node #2 ... DONE
MultisessionFuture started
Chunk #2 of 2 ... DONE
Launching 2 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 2
length: 1 (resolved future 2)
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
..- attr(*, "class")= chr [1:4] "multicore" "multiprocess" "future" "function"
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 1 ... DONE
- plan(list('multisession', 'multicore')) ... DONE
- plan(list('multisession', 'multisession')) ...
plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ...
multisession:
- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), gc = FALSE, earlySignal = FALSE, label = NULL, ...)
- tweaked: FALSE
- call: plan(list(a = strategy1, b = strategy2))
Workers: [n = 2] 'localhost', 'localhost'
Base port: 11346
Creating node 1 of 2 ...
- setting up node
Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11346 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #1 on 'localhost' to connect back
Connection with worker #1 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 1 of 2 ... done
Creating node 2 of 2 ...
- setting up node
Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11346 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #2 on 'localhost' to connect back
Connection with worker #2 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 2 of 2 ... done
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 0): <none>
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in "future") {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local(NA)
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
MultisessionFuture started
plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ... DONE
plan(): nbrOfWorkers() = 2
foreach() - level 1 ...
doFuture() ...
- dummy globals (as locals): [1] 'a'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 124 bytes (124 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
List of 3
$ bs : int [1:3] 3 2 1
$ strategy2 : chr "multisession"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ bs :<environment: R_GlobalEnv>
..$ strategy2 :<environment: R_GlobalEnv>
..$ ...future.x_ii:<environment: 9940f40>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 124
- packages: [1] 'foreach'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 160 bytes (160 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
Exporting 3 global objects (160 bytes) to cluster node #1 ...
Exporting 'bs' (44 bytes) to cluster node #1 ...
Exporting 'bs' (44 bytes) to cluster node #1 ... DONE
Exporting 'strategy2' (80 bytes) to cluster node #1 ...
Exporting 'strategy2' (80 bytes) to cluster node #1 ... DONE
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
Exporting 3 global objects (160 bytes) to cluster node #1 ... DONE
MultisessionFuture started
Chunk #1 of 2 ... DONE
Chunk #2 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 160 bytes (160 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
Exporting 3 global objects (160 bytes) to cluster node #2 ...
Exporting 'bs' (44 bytes) to cluster node #2 ...
Exporting 'bs' (44 bytes) to cluster node #2 ... DONE
Exporting 'strategy2' (80 bytes) to cluster node #2 ...
Exporting 'strategy2' (80 bytes) to cluster node #2 ... DONE
Exporting '...future.x_ii' (36 bytes) to cluster node #2 ...
Exporting '...future.x_ii' (36 bytes) to cluster node #2 ... DONE
Exporting 3 global objects (160 bytes) to cluster node #2 ... DONE
MultisessionFuture started
Chunk #2 of 2 ... DONE
Launching 2 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 2
length: 1 (resolved future 2)
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL, ...)
..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
..- attr(*, "init")= logi TRUE
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL, ...)
..- attr(*, "class")= chr [1:5] "multisession" "cluster" "multiprocess" "future" ...
..- attr(*, "init")= logi TRUE
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 1 ... DONE
- plan(list('multisession', 'multisession')) ... DONE
- plan(list('multisession', 'cluster')) ...
plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ...
multisession:
- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, persistent = FALSE, workers = availableCores(), gc = FALSE, earlySignal = FALSE, label = NULL, ...)
- tweaked: FALSE
- call: plan(list(a = strategy1, b = strategy2))
Workers: [n = 2] 'localhost', 'localhost'
Base port: 11399
Creating node 1 of 2 ...
- setting up node
Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11399 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #1 on 'localhost' to connect back
Connection with worker #1 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 1 of 2 ... done
Creating node 2 of 2 ...
- setting up node
Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11399 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #2 on 'localhost' to connect back
Connection with worker #2 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 2 of 2 ... done
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 0): <none>
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in "future") {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local(NA)
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
MultisessionFuture started
plan(): plan_init() of 'multisession', 'cluster', 'multiprocess', 'future', 'function' ... DONE
plan(): nbrOfWorkers() = 2
foreach() - level 1 ...
doFuture() ...
- dummy globals (as locals): [1] 'a'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 116 bytes (116 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
List of 3
$ bs : int [1:3] 3 2 1
$ strategy2 : chr "cluster"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ bs :<environment: R_GlobalEnv>
..$ strategy2 :<environment: R_GlobalEnv>
..$ ...future.x_ii:<environment: 9899cf0>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 116
- packages: [1] 'foreach'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 152 bytes (152 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
Exporting 3 global objects (152 bytes) to cluster node #1 ...
Exporting 'bs' (44 bytes) to cluster node #1 ...
Exporting 'bs' (44 bytes) to cluster node #1 ... DONE
Exporting 'strategy2' (72 bytes) to cluster node #1 ...
Exporting 'strategy2' (72 bytes) to cluster node #1 ... DONE
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
Exporting 3 global objects (152 bytes) to cluster node #1 ... DONE
MultisessionFuture started
Chunk #1 of 2 ... DONE
Chunk #2 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 152 bytes (152 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
{
has_future <- requireNamespace("future",
quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info),
info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
...future.mc.cores.old <- getOption("mc.cores")
options(mc.cores = 1L)
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
{
options(mc.cores = ...future.mc.cores.old)
}
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableCores(),
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(length(workers) == 1, is.finite(workers),
workers >= 1)
if (workers == 1L) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = TRUE, seed = seed, globals = globals,
local = TRUE, label = label))
}
workers <- ClusterRegistry("start", workers = workers)
future <- MultisessionFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
Exporting 3 global objects (152 bytes) to cluster node #2 ...
Exporting 'bs' (44 bytes) to cluster node #2 ...
Exporting 'bs' (44 bytes) to cluster node #2 ... DONE
Exporting 'strategy2' (72 bytes) to cluster node #2 ...
Exporting 'strategy2' (72 bytes) to cluster node #2 ... DONE
Exporting '...future.x_ii' (36 bytes) to cluster node #2 ...
Exporting '...future.x_ii' (36 bytes) to cluster node #2 ... DONE
Exporting 3 global objects (152 bytes) to cluster node #2 ... DONE
MultisessionFuture started
Chunk #2 of 2 ... DONE
Launching 2 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 2
length: 1 (resolved future 1)
length: 0 (resolved future 2)
resolve() on list ... DONE
- collecting values of future
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE,
label = NULL, ...)
..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
..- attr(*, "init")= logi TRUE
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE,
label = NULL, ...)
..- attr(*, "class")= chr [1:4] "cluster" "multiprocess" "future" "function"
..- attr(*, "init")= logi TRUE
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 1 ... DONE
- plan(list('multisession', 'cluster')) ... DONE
- plan(list('cluster', 'sequential')) ...
plan(): plan_init() of 'cluster', 'multiprocess', 'future', 'function' ...
cluster:
- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(), user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE, label = NULL, ...)
- tweaked: FALSE
- call: plan(list(a = strategy1, b = strategy2))
Workers: [n = 2] 'localhost', 'localhost'
Base port: 11530
Creating node 1 of 2 ...
- setting up node
Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11530 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #1 on 'localhost' to connect back
Connection with worker #1 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 1 of 2 ... done
Creating node 2 of 2 ...
- setting up node
Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11530 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #2 on 'localhost' to connect back
Connection with worker #2 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 2 of 2 ... done
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 0): <none>
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
local({
for (pkg in "future") {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local(NA)
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
ClusterFuture started
plan(): plan_init() of 'cluster', 'multiprocess', 'future', 'function' ... DONE
plan(): nbrOfWorkers() = 2
foreach() - level 1 ...
doFuture() ...
- dummy globals (as locals): [1] 'a'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 124 bytes (124 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
List of 3
$ bs : int [1:3] 3 2 1
$ strategy2 : chr "sequential"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ bs :<environment: R_GlobalEnv>
..$ strategy2 :<environment: R_GlobalEnv>
..$ ...future.x_ii:<environment: 946fcc8>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 124
- packages: [1] 'foreach'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 160 bytes (160 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
Exporting 3 global objects (160 bytes) to cluster node #1 ...
Exporting 'bs' (44 bytes) to cluster node #1 ...
Exporting 'bs' (44 bytes) to cluster node #1 ... DONE
Exporting 'strategy2' (80 bytes) to cluster node #1 ...
Exporting 'strategy2' (80 bytes) to cluster node #1 ... DONE
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ...
Exporting '...future.x_ii' (36 bytes) to cluster node #1 ... DONE
Exporting 3 global objects (160 bytes) to cluster node #1 ... DONE
ClusterFuture started
Chunk #1 of 2 ... DONE
Chunk #2 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: FALSE
The total size of the 3 globals is 160 bytes (160 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 1): 'foreach'
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
local({
for (pkg in c("future", "foreach")) {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local({
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
})
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, local = TRUE, earlySignal = FALSE,
label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
local <- as.logical(local)
future <- SequentialFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, local = local, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
Exporting 3 global objects (160 bytes) to cluster node #2 ...
Exporting 'bs' (44 bytes) to cluster node #2 ...
Exporting 'bs' (44 bytes) to cluster node #2 ... DONE
Exporting 'strategy2' (80 bytes) to cluster node #2 ...
Exporting 'strategy2' (80 bytes) to cluster node #2 ... DONE
Exporting '...future.x_ii' (36 bytes) to cluster node #2 ...
Exporting '...future.x_ii' (36 bytes) to cluster node #2 ... DONE
Exporting 3 global objects (160 bytes) to cluster node #2 ... DONE
ClusterFuture started
Chunk #2 of 2 ... DONE
Launching 2 futures (chunks) ... DONE
- resolving future
resolve() on list ...
recursive: 0
length: 2
length: 1 (resolved future 2)
length: 0 (resolved future 1)
resolve() on list ... DONE
- collecting values of future
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ b:function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language plan(list(a = strategy1, b = strategy2))
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
List of 1
$ :function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE,
seed = NULL, globals = TRUE, local = TRUE, earlySignal = FALSE, label = NULL,
...)
..- attr(*, "class")= chr [1:4] "sequential" "uniprocess" "future" "function"
..- attr(*, "call")= language future::plan("default", .cleanup = FALSE, .init = FALSE)
- attr(*, "class")= chr [1:2] "FutureStrategyList" "list"
- accumulating results
- processing errors (handler = 'stop')
- extracting results
doFuture() ... DONE
foreach() - level 1 ... DONE
- plan(list('cluster', 'sequential')) ... DONE
- plan(list('cluster', 'multicore')) ...
plan(): plan_init() of 'cluster', 'multiprocess', 'future', 'function' ...
cluster:
- args: function (expr, envir = parent.frame(), substitute = TRUE, lazy = FALSE, seed = NULL, globals = TRUE, persistent = FALSE, workers = availableWorkers(), user = NULL, revtunnel = TRUE, homogeneous = TRUE, gc = FALSE, earlySignal = FALSE, label = NULL, ...)
- tweaked: FALSE
- call: plan(list(a = strategy1, b = strategy2))
Workers: [n = 2] 'localhost', 'localhost'
Base port: 11303
Creating node 1 of 2 ...
- setting up node
Starting worker #1 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11303 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #1 on 'localhost' to connect back
Connection with worker #1 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 1 of 2 ... done
Creating node 2 of 2 ...
- setting up node
Starting worker #2 on 'localhost': '/home/ripley/R/cc/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11303 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE
Waiting for worker #2 on 'localhost' to connect back
Connection with worker #2 on 'localhost' established
- assigning connection UUID
- collecting session information
Creating node 2 of 2 ... done
Packages needed by future strategies (n = 1): 'future'
Packages needed by the future expression (n = 0): <none>
{
{
...future.oldOptions <- options(future.startup.loadScript = FALSE,
future.globals.onMissing = "ignore", future.globals.maxSize = NULL,
future.globals.method = NULL, future.globals.onMissing = "ignore",
future.globals.onReference = NULL, future.globals.resolve = NULL,
future.resolve.recursive = NULL, width = 80L)
{
{
{
has_future <- requireNamespace("future", quietly = TRUE)
version <- if (has_future)
packageVersion("future")
else NULL
if (!has_future || version < "1.8.0") {
info <- c(r_version = gsub("R version ",
"", R.version$version.string), platform = sprintf("%s (%s-bit)",
R.version$platform, 8 * .Machine$sizeof.pointer),
os = paste(Sys.info()[c("sysname", "release",
"version")], collapse = " "), hostname = Sys.info()[["nodename"]])
info <- sprintf("%s: %s", names(info), info)
info <- paste(info, collapse = "; ")
if (!has_future) {
msg <- sprintf("Package 'future' is not installed on worker (%s)",
info)
}
else {
msg <- sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s",
info, version)
}
stop(msg)
}
}
local({
for (pkg in "future") {
loadNamespace(pkg)
library(pkg, character.only = TRUE)
}
})
}
future::plan(list(b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >= 1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
}
if (is.na(TRUE)) {
}
else {
if (TRUE) {
...future.stdout <- rawConnection(raw(0L), open = "w")
}
else {
...future.stdout <- file(switch(.Platform$OS.type,
windows = "NUL", "/dev/null"), open = "w")
}
sink(...future.stdout, type = "output", split = FALSE)
on.exit(if (!is.null(...future.stdout)) {
sink(type = "output", split = FALSE)
close(...future.stdout)
}, add = TRUE)
}
...future.result <- tryCatch({
...future.value <- local(NA)
future::FutureResult(value = ...future.value, version = "1.8")
}, error = function(cond) {
calls <- sys.calls()
structure(list(value = NULL, value2 = NA, condition = cond,
calls = calls, version = "1.8"), class = "FutureResult")
}, finally = {
{
{
NULL
future::plan(list(a = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, persistent = FALSE, workers = availableWorkers(),
user = NULL, revtunnel = TRUE, homogeneous = TRUE,
gc = FALSE, earlySignal = FALSE, label = NULL,
...)
{
if (substitute)
expr <- substitute(expr)
future <- ClusterFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, persistent = persistent,
workers = workers, user = user, revtunnel = revtunnel,
homogeneous = homogeneous, gc = gc, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}, b = function (expr, envir = parent.frame(),
substitute = TRUE, lazy = FALSE, seed = NULL,
globals = TRUE, workers = availableCores(constraints = "multicore"),
earlySignal = FALSE, label = NULL, ...)
{
if (substitute)
expr <- substitute(expr)
if (is.function(workers))
workers <- workers()
workers <- as.integer(workers)
stop_if_not(is.finite(workers), workers >=
1L)
if (workers == 1L || !supportsMulticore()) {
return(sequential(expr, envir = envir, substitute = FALSE,
lazy = lazy, seed = seed, globals = globals,
local = TRUE, label = label))
}
oopts <- options(mc.cores = workers)
on.exit(options(oopts))
future <- MulticoreFuture(expr = expr, envir = envir,
substitute = FALSE, lazy = lazy, seed = seed,
globals = globals, workers = workers, earlySignal = earlySignal,
label = label, ...)
if (!future$lazy)
future <- run(future)
invisible(future)
}), .cleanup = FALSE, .init = FALSE)
}
options(...future.oldOptions)
}
})
if (is.na(TRUE)) {
}
else {
sink(type = "output", split = FALSE)
if (TRUE) {
...future.result$stdout <- rawToChar(rawConnectionValue(...future.stdout))
}
else {
...future.result["stdout"] <- list(NULL)
}
close(...future.stdout)
...future.stdout <- NULL
}
...future.result
}
ClusterFuture started
plan(): plan_init() of 'cluster', 'multiprocess', 'future', 'function' ... DONE
plan(): nbrOfWorkers() = 2
foreach() - level 1 ...
doFuture() ...
- dummy globals (as locals): [1] 'a'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ...
getGlobalsAndPackages() ...
Retrieving globals ...
- globals retrieved: [3] 'bs', 'strategy2', '...future.x_ii'
Retrieving globals ... DONE
Resolving globals: FALSE
The total size of the 3 globals is 124 bytes (124 bytes)
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
getGlobalsAndPackages() ... DONE
- globals: [3] 'bs', 'strategy2', '...future.x_ii'
List of 3
$ bs : int [1:3] 3 2 1
$ strategy2 : chr "multicore"
$ ...future.x_ii: NULL
- attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
- attr(*, "where")=List of 3
..$ bs :<environment: R_GlobalEnv>
..$ strategy2 :<environment: R_GlobalEnv>
..$ ...future.x_ii:<environment: 9393f70>
- attr(*, "resolved")= logi FALSE
- attr(*, "total_size")= num 124
- packages: [1] 'foreach'
- R expression:
{
doFuture::registerDoFuture()
lapply(seq_along(...future.x_ii), FUN = function(jj) {
...future.x_jj <- ...future.x_ii[[jj]]
a <- NULL
...future.env <- environment()
local({
for (name in names(...future.x_jj)) {
assign(name, ...future.x_jj[[name]], envir = ...future.env,
inherits = FALSE)
}
})
tryCatch({
library("foreach")
{
plan <- future::plan()
stopifnot(inherits(plan, strategy2))
plan_a <- future::plan("list")
str(plan_a)
stopifnot(inherits(plan_a[[1]], strategy2))
message("foreach() - level 2 ...")
y <- foreach(b = bs, .export = c("a", "plan_a")) %dopar%
{
plan <- future::plan()
message(capture.output(print(plan)))
stopifnot(inherits(plan, "future"), inherits(plan,
getOption("future.default", "sequential")))
plan_b <- future::plan("list")
str(plan_b)
stopifnot(inherits(plan_b[[1]], "future"),
inherits(plan_b[[1]], getOption("future.default",
"sequential")))
list(a = a, plan_a = plan_a, b = b, plan_b = plan_b)
}
message("foreach() - level 2 ... DONE")
y
}
}, error = identity)
})
}
- identifying globals and packages ... DONE
Number of chunks: 2
Number of futures (= number of chunks): 2
Launching 2 futures (chunks) ...
Chunk #1 of 2 ...
getGlobalsAndPackages() ...
- globals passed as-is: [3] 'bs', 'strategy2', '...future.x_ii'
Resolving globals: