R Under development (unstable) (2023-06-30 r84625 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > source("incl/start.R") [18:01:34.163] plan(): Setting new future strategy stack: [18:01:34.165] List of future strategies: [18:01:34.165] 1. sequential: [18:01:34.165] - args: function (..., envir = parent.frame()) [18:01:34.165] - tweaked: FALSE [18:01:34.165] - call: future::plan("sequential") [18:01:34.180] plan(): nbrOfWorkers() = 1 > > options(future.debug = FALSE) > message("*** futureCall() ...") *** futureCall() ... > > message("- futureCall() - sequential + lazy ...") - futureCall() - sequential + lazy ... > > f1 <- future(do.call(rnorm, args = list(n = 100)), seed = NULL, lazy = TRUE) > f2 <- futureCall(rnorm, args = list(n = 100), seed = NULL, lazy = TRUE) > > set.seed(42L) > v0 <- rnorm(n = 100) > str(list(v0 = v0)) List of 1 $ v0: num [1:100] 1.371 -0.565 0.363 0.633 0.404 ... > > set.seed(42L) > v1 <- value(f1) > str(list(v1 = v1)) List of 1 $ v1: num [1:100] 1.371 -0.565 0.363 0.633 0.404 ... > > set.seed(42L) > v2 <- value(f2) > str(list(v2 = v2)) List of 1 $ v2: num [1:100] 1.371 -0.565 0.363 0.633 0.404 ... > > ## Because we use lazy futures and set the > ## random seed just before they are resolved > stopifnot(all.equal(v1, v0)) > stopifnot(all.equal(v1, v2)) > > message("- futureCall() - sequential + lazy ... DONE") - futureCall() - sequential + lazy ... DONE > > message("- futureCall() - mix of strategies, cores, lazy and globals ...") - futureCall() - mix of strategies, cores, lazy and globals ... > > a <- 3 > args <- list(x = 42, y = 12) > v0 <- do.call(function(x, y) a * (x - y), args = args) > > for (cores in 1:availCores) { + ## Speed up CRAN checks: Skip on CRAN Windows 32-bit + if (!fullTest && isWin32) next + + message(sprintf("Testing with %d cores ...", cores)) + options(mc.cores = cores) + strategies <- supportedStrategies(cores) + + for (strategy in strategies) { + message(sprintf("- plan('%s') ...", strategy)) + plan(strategy) + + for (lazy in c(FALSE, TRUE)) { + for (globals in c(FALSE, TRUE)) { + message("- futureCall() #1") + a <- 3 + args <- list(x = 42, y = 12) + f <- futureCall(function(x, y) a * (x - y), args = args, + globals = globals, lazy = lazy) + rm(list = c("a", "args")) + print(f) + res1 <- tryCatch({ + v1 <- value(f) + }, error = identity) + stopifnot(!inherits(res1, "FutureError")) + if (isTRUE(as.logical(Sys.getenv("R_CHECK_IDEAL")))) { + if (globals) { + stopifnot(all.equal(v1, v0)) + } else { + stopifnot(inherits(res1, "error")) + } + } else { + if (!inherits(res1, "error")) { + utils::str(list(strategy = strategy, globals = globals, lazy = lazy, v0 = v0, v1 = v1)) + stopifnot(all.equal(v1, v0)) + } else { + stopifnot(!globals) + } + } + + message("- futureCall() #2") + a <- 3 + args <- list(x = 42, y = 12) + f <- futureCall(function(x, y) a * (x - y), args = args, + globals = "a", lazy = lazy) + rm(list = c("a", "args")) + print(f) + res2 <- tryCatch({ + v2 <- value(f) + }, error = identity) + stopifnot(!inherits(res2, "FutureError")) + if (isTRUE(as.logical(Sys.getenv("R_CHECK_IDEAL")))) { + if (globals) { + stopifnot(all.equal(v2, v0)) + } else { + stopifnot(inherits(res2, "error")) + } + } else { + if (!inherits(res2, "error")) { + utils::str(list(strategy = strategy, globals = globals, lazy = lazy, v0 = v0, v2 = v2)) + stopifnot(all.equal(v2, v0)) + } else { + stopifnot(!globals) + } + } + + message("- futureCall() #3") + args <- list(x = 42, y = 12) + f <- futureCall(function(x, y) a * (x - y), args = args, + globals = list(a = 3), lazy = lazy) + rm(list = "args") + print(f) + res3 <- tryCatch({ + v3 <- value(f) + }, error = identity) + stopifnot(!inherits(res3, "FutureError")) + if (isTRUE(as.logical(Sys.getenv("R_CHECK_IDEAL")))) { + if (globals) { + stopifnot(all.equal(v3, v0)) + } else { + stopifnot(inherits(res3, "error")) + } + } else { + if (!inherits(res3, "error")) { + utils::str(list(strategy = strategy, globals = globals, lazy = lazy, v0 = v0, v3 = v3, res3 = res3)) + stopifnot(all.equal(v3, v0)) + } else { + stopifnot(!globals) + } + } + + message("- futureCall() #4") + ## FIXME: This works and fails in non-expected ways /HB 2022-05-26 + local({ + a <- 2 + g <- function() a + f <- futureCall(g, globals = globals, lazy = lazy) + rm(list = "a") + + truth <- 2 + message("truth: ", truth) + + v4 <- tryCatch(value(f), error = identity) + print(v4) + + utils::str(list(strategy = strategy, globals = globals, lazy = lazy, v4 = v4)) + + if (isTRUE(as.logical(Sys.getenv("R_CHECK_IDEAL")))) { + if (globals) { + stopifnot(identical(v4, truth)) + } else { + stopifnot(inherits(v4, "error")) + } + } else if (isTRUE(getOption("future.globals.keepWhere", FALSE))) { + if (isTRUE(getOption("future.globals.globalsOf.locals", TRUE))) { + if (globals) { + stopifnot(identical(v4, truth)) + } else if (lazy) { + stopifnot(inherits(v4, "error")) + } else { + stopifnot(identical(v4, truth)) + } + } else { + if (lazy) { + stopifnot(inherits(v4, "error")) + } else { + stopifnot(identical(v4, truth)) + } + } + } else { + if (isTRUE(getOption("future.globals.globalsOf.locals", TRUE))) { + if (globals) { + stopifnot(identical(v4, truth)) + } else if (lazy) { + stopifnot(inherits(v4, "error")) + } else if (strategy %in% c("sequential", "multicore")) { + stopifnot(inherits(v4, "error")) + } else { + stopifnot(identical(v4, truth)) + } + } else { + if (strategy %in% c("sequential", "multicore")) { + stopifnot(inherits(v4, "error")) + } else if (lazy) { + stopifnot(inherits(v4, "error")) + } else { + stopifnot(identical(v4, truth)) + } + } + } + }) + + rm(list = c("v1", "v2", "v3", "v4")) + } + } + } + message(sprintf("Testing with %d cores ... DONE", cores)) + } Testing with 1 cores ... - plan('sequential') ... - futureCall() #1 SequentialFuture: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: FALSE Asynchronous evaluation: FALSE Local evaluation: TRUE Environment: 0x0000027eda5c09d0 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 2 objects totaling 2.46 KiB (function 'FUN' of 2.35 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: 56 bytes of class 'numeric' Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment' List of 5 $ strategy: chr "sequential" $ globals : logi FALSE $ lazy : logi FALSE $ v0 : num 90 $ v1 : num 90 - futureCall() #2 SequentialFuture: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: FALSE Asynchronous evaluation: FALSE Local evaluation: TRUE Environment: 0x0000027edaab7220 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: 56 bytes of class 'numeric' Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment' List of 5 $ strategy: chr "sequential" $ globals : logi FALSE $ lazy : logi FALSE $ v0 : num 90 $ v2 : num 90 - futureCall() #3 SequentialFuture: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: FALSE Asynchronous evaluation: FALSE Local evaluation: TRUE Environment: 0x0000027edae89568 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: 56 bytes of class 'numeric' Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment' List of 6 $ strategy: chr "sequential" $ globals : logi FALSE $ lazy : logi FALSE $ v0 : num 90 $ v3 : num 90 $ res3 : num 90 - futureCall() #4 truth: 2 List of 4 $ strategy: chr "sequential" $ globals : logi FALSE $ lazy : logi FALSE $ v4 :List of 2 ..$ message: chr "object 'a' not found" ..$ call : language (function () a)() ..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition" Warning in rm(list = c("v1", "v2", "v3", "v4")) : object 'v4' not found - futureCall() #1 SequentialFuture: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: FALSE Asynchronous evaluation: FALSE Local evaluation: TRUE Environment: 0x0000027ed8f8aea0 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (function 'FUN' of 1.15 KiB, list 'args' of 112 bytes, numeric 'a' of 56 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: 56 bytes of class 'numeric' Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment' List of 5 $ strategy: chr "sequential" $ globals : logi TRUE $ lazy : logi FALSE $ v0 : num 90 $ v1 : num 90 - futureCall() #2 SequentialFuture: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: FALSE Asynchronous evaluation: FALSE Local evaluation: TRUE Environment: 0x0000027edaa956f0 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: 56 bytes of class 'numeric' Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment' List of 5 $ strategy: chr "sequential" $ globals : logi TRUE $ lazy : logi FALSE $ v0 : num 90 $ v2 : num 90 - futureCall() #3 SequentialFuture: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: FALSE Asynchronous evaluation: FALSE Local evaluation: TRUE Environment: 0x0000027edae4d298 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: 56 bytes of class 'numeric' Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment' List of 6 $ strategy: chr "sequential" $ globals : logi TRUE $ lazy : logi FALSE $ v0 : num 90 $ v3 : num 90 $ res3 : num 90 - futureCall() #4 truth: 2 [1] 2 List of 4 $ strategy: chr "sequential" $ globals : logi TRUE $ lazy : logi FALSE $ v4 : num 2 Warning in rm(list = c("v1", "v2", "v3", "v4")) : object 'v4' not found - futureCall() #1 Future: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: TRUE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027ed8facff0 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 2 objects totaling 2.46 KiB (function 'FUN' of 2.35 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: FALSE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'Future', 'environment' - futureCall() #2 Future: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: TRUE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027eda777110 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: FALSE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'Future', 'environment' List of 5 $ strategy: chr "sequential" $ globals : logi FALSE $ lazy : logi TRUE $ v0 : num 90 $ v2 : num 90 - futureCall() #3 Future: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: TRUE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027edabb2ea0 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: FALSE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'Future', 'environment' List of 6 $ strategy: chr "sequential" $ globals : logi FALSE $ lazy : logi TRUE $ v0 : num 90 $ v3 : num 90 $ res3 : num 90 - futureCall() #4 truth: 2 List of 4 $ strategy: chr "sequential" $ globals : logi FALSE $ lazy : logi TRUE $ v4 :List of 2 ..$ message: chr "object 'a' not found" ..$ call : language (function () a)() ..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition" Warning in rm(list = c("v1", "v2", "v3", "v4")) : object 'v1' not found Warning in rm(list = c("v1", "v2", "v3", "v4")) : object 'v4' not found - futureCall() #1 Future: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: TRUE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027ed8ca1730 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (function 'FUN' of 1.15 KiB, list 'args' of 112 bytes, numeric 'a' of 56 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: FALSE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'Future', 'environment' List of 5 $ strategy: chr "sequential" $ globals : logi TRUE $ lazy : logi TRUE $ v0 : num 90 $ v1 : num 90 - futureCall() #2 Future: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: TRUE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027eda70a5e0 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: FALSE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'Future', 'environment' List of 5 $ strategy: chr "sequential" $ globals : logi TRUE $ lazy : logi TRUE $ v0 : num 90 $ v2 : num 90 - futureCall() #3 Future: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: TRUE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027edab8e148 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: FALSE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'Future', 'environment' List of 6 $ strategy: chr "sequential" $ globals : logi TRUE $ lazy : logi TRUE $ v0 : num 90 $ v3 : num 90 $ res3 : num 90 - futureCall() #4 truth: 2 [1] 2 List of 4 $ strategy: chr "sequential" $ globals : logi TRUE $ lazy : logi TRUE $ v4 : num 2 Warning in rm(list = c("v1", "v2", "v3", "v4")) : object 'v4' not found Testing with 1 cores ... DONE Testing with 2 cores ... - plan('multisession') ... - futureCall() #1 MultisessionFuture: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027edac1e768 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 2 objects totaling 2.46 KiB (function 'FUN' of 2.35 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'MultisessionFuture', 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' - futureCall() #2 MultisessionFuture: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027eda538d50 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'MultisessionFuture', 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' List of 5 $ strategy: chr "multisession" $ globals : logi FALSE $ lazy : logi FALSE $ v0 : num 90 $ v2 : num 90 - futureCall() #3 MultisessionFuture: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027ed8764108 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'MultisessionFuture', 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' List of 6 $ strategy: chr "multisession" $ globals : logi FALSE $ lazy : logi FALSE $ v0 : num 90 $ v3 : num 90 $ res3 : num 90 - futureCall() #4 truth: 2 [1] 2 List of 4 $ strategy: chr "multisession" $ globals : logi FALSE $ lazy : logi FALSE $ v4 : num 2 Warning in rm(list = c("v1", "v2", "v3", "v4")) : object 'v1' not found Warning in rm(list = c("v1", "v2", "v3", "v4")) : object 'v4' not found - futureCall() #1 MultisessionFuture: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027edc575908 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (function 'FUN' of 1.15 KiB, list 'args' of 112 bytes, numeric 'a' of 56 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'MultisessionFuture', 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' List of 5 $ strategy: chr "multisession" $ globals : logi TRUE $ lazy : logi FALSE $ v0 : num 90 $ v1 : num 90 - futureCall() #2 MultisessionFuture: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027edcc3dcb8 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'MultisessionFuture', 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' List of 5 $ strategy: chr "multisession" $ globals : logi TRUE $ lazy : logi FALSE $ v0 : num 90 $ v2 : num 90 - futureCall() #3 MultisessionFuture: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027edd161dd8 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'MultisessionFuture', 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' List of 6 $ strategy: chr "multisession" $ globals : logi TRUE $ lazy : logi FALSE $ v0 : num 90 $ v3 : num 90 $ res3 : num 90 - futureCall() #4 truth: 2 [1] 2 List of 4 $ strategy: chr "multisession" $ globals : logi TRUE $ lazy : logi FALSE $ v4 : num 2 Warning in rm(list = c("v1", "v2", "v3", "v4")) : object 'v4' not found - futureCall() #1 Future: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: TRUE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027edb2b7f40 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 2 objects totaling 2.46 KiB (function 'FUN' of 2.35 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: FALSE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'Future', 'environment' - futureCall() #2 Future: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: TRUE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027edae2d760 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: FALSE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'Future', 'environment' List of 5 $ strategy: chr "multisession" $ globals : logi FALSE $ lazy : logi TRUE $ v0 : num 90 $ v2 : num 90 - futureCall() #3 Future: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: TRUE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027eda7ba1f0 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: FALSE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'Future', 'environment' List of 6 $ strategy: chr "multisession" $ globals : logi FALSE $ lazy : logi TRUE $ v0 : num 90 $ v3 : num 90 $ res3 : num 90 - futureCall() #4 truth: 2 List of 4 $ strategy: chr "multisession" $ globals : logi FALSE $ lazy : logi TRUE $ v4 :List of 2 ..$ message: chr "object 'a' not found" ..$ call : language (function () a)() ..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition" Warning in rm(list = c("v1", "v2", "v3", "v4")) : object 'v1' not found Warning in rm(list = c("v1", "v2", "v3", "v4")) : object 'v4' not found - futureCall() #1 Future: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: TRUE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027edc1689e0 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (function 'FUN' of 1.15 KiB, list 'args' of 112 bytes, numeric 'a' of 56 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: FALSE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'Future', 'environment' List of 5 $ strategy: chr "multisession" $ globals : logi TRUE $ lazy : logi TRUE $ v0 : num 90 $ v1 : num 90 - futureCall() #2 Future: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: TRUE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027edc78f3c0 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: FALSE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'Future', 'environment' List of 5 $ strategy: chr "multisession" $ globals : logi TRUE $ lazy : logi TRUE $ v0 : num 90 $ v2 : num 90 - futureCall() #3 Future: Label: '' Expression: do.call(what = FUN, args = args) Lazy evaluation: TRUE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: 0x0000027edcd1a9e8 Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: FALSE Value: Conditions captured: Early signaling: FALSE Owner process: 34a83c74-4cca-ea0b-27d5-6acd69a51c6f Class: 'Future', 'environment' List of 6 $ strategy: chr "multisession" $ globals : logi TRUE $ lazy : logi TRUE $ v0 : num 90 $ v3 : num 90 $ res3 : num 90 - futureCall() #4 truth: 2 [1] 2 List of 4 $ strategy: chr "multisession" $ globals : logi TRUE $ lazy : logi TRUE $ v4 : num 2 Warning in rm(list = c("v1", "v2", "v3", "v4")) : object 'v4' not found Testing with 2 cores ... DONE > > message("- futureCall() - mix of strategies, cores, lazy and globals ... DONE") - futureCall() - mix of strategies, cores, lazy and globals ... DONE > > message("- futureCall() - bug fixes") - futureCall() - bug fixes > > plan(sequential) > plan(cluster, workers = 1L) > > fcn <- function() a > v <- tryCatch(local({ + abc <- 42 + f <- futureCall(fcn, args = list(), globals = "abc") + value(f) + }), error = identity) > > ## Bug #262: the above used to return NULL > stopifnot(!is.null(v)) > > ## Bug: Now, it instead fails, because it cannot find 'abc' > print(v) > stopifnot(inherits(v, "error")) > > message("*** futureCall() ... DONE") *** futureCall() ... DONE > > source("incl/end.R") Failed to undo environment variables: - Expected environment variables: [n=201] '!ExitCode', 'ALLUSERSPROFILE', 'APPDATA', 'BIBINPUTS', 'BINDIR', 'BSTINPUTS', 'COMMONPROGRAMFILES', 'COMPUTERNAME', 'COMSPEC', 'CURL_CA_BUNDLE', 'CYGWIN', 'CommonProgramFiles(x86)', 'CommonProgramW6432', 'DriverData', 'HOME', 'HOMEDRIVE', 'HOMEPATH', 'JAGS_ROOT', 'JAVA_HOME', 'LANGUAGE', 'LC_COLLATE', 'LC_MONETARY', 'LC_TIME', 'LOCALAPPDATA', 'LOGONSERVER', 'LS_HOME', 'LS_LICENSE_PATH', 'MAKE', 'MAKEFLAGS', 'MAKELEVEL', 'MFLAGS', 'MSMPI_BENCHMARKS', 'MSMPI_BIN', 'MSYS2_ENV_CONV_EXCL', 'NUMBER_OF_PROCESSORS', 'OMP_THREAD_LIMIT', 'OS', 'PATH', 'PATHEXT', 'PROCESSOR_ARCHITECTURE', 'PROCESSOR_IDENTIFIER', 'PROCESSOR_LEVEL', 'PROCESSOR_REVISION', 'PROGRAMFILES', 'PROMPT', 'PSModulePath', 'PUBLIC', 'PWD', 'ProgramData', 'ProgramFiles(x86)', 'ProgramW6432', 'RETICULATE_AUTOCONFIGURE', 'RTOOLS43_HOME', 'R_ARCH', 'R_BROWSER', 'R_BZIPCMD', 'R_CMD', 'R_COMPILED_BY', 'R_CRAN_WEB', 'R_CUSTOM_TOOLS_PATH', 'R_CUSTOM_TOOLS_SOFT', 'R_DOC_DIR', 'R_ENVIRON_USER', 'R_GSCMD', 'R_GZIPCMD', 'R_HOME', 'R_INCLUDE_DIR', 'R_INSTALL_TAR', 'R_LIBS', 'R_LIBS_SITE', 'R_LIBS_USER', 'R_MAX_NUM_DLLS', 'R_OSTYPE', 'R_PAPERSIZE', 'R_PAPERSIZE_USER', 'R_PARALLELLY_MAKENODEPSOCK_AUTOKILL', 'R_PARALLELLY_MAKENODEPSOCK_CONNECTTIMEOUT', 'R_PARALLELLY_MAKENODEPSOCK_RSCRIPT_LABEL', 'R_PARALLELLY_MAKENODEPSOCK_SESSIONINFO_PKGS', 'R_PARALLELLY_MAKENODEPSOCK_TIMEOUT', 'R_PARALLELLY_RANDOM_PORTS', 'R_PARALLEL_PORT', 'R_RD4PDF', 'R_RTOOLS43_PATH', 'R_SCRIPT_LEGACY', 'R_SHARE_DIR', 'R_TESTS', 'R_UNZIPCMD', 'R_USER', 'R_VERSION', 'R_ZIPCMD', 'SED', 'SHLVL', 'SYSTEMDRIVE', 'SYSTEMROOT', 'TAR', 'TAR_OPTIONS', 'TEMP', 'TERM', 'TEXINPUTS', 'TMP', 'TMPDIR', 'USERDOMAIN', 'USERDOMAIN_ROAMINGPROFILE', 'USERNAME', 'USERPROFILE', 'WINDIR', '_', '_R_CHECK_AUTOCONF_', '_R_CHECK_BOGUS_RETURN_', '_R_CHECK_BROWSER_NONINTERACTIVE_', '_R_CHECK_BUILD_VIGNETTES_SEPARATELY_', '_R_CHECK_CODETOOLS_PROFILE_', '_R_CHECK_CODE_ASSIGN_TO_GLOBALENV_', '_R_CHECK_CODE_ATTACH_', '_R_CHECK_CODE_CLASS_IS_STRING_', '_R_CHECK_CODE_DATA_INTO_GLOBALENV_', '_R_CHECK_CODE_USAGE_VIA_NAMESPACES_', '_R_CHECK_CODE_USAGE_WITHOUT_LOADING_', '_R_CHECK_CODE_USAGE_WITH_ONLY_BASE_ATTACHED_', '_R_CHECK_CODOC_VARIABLES_IN_USAGES_', '_R_CHECK_COMPACT_DATA2_', '_R_CHECK_COMPILATION_FLAGS_', '_R_CHECK_CONNECTIONS_LEFT_OPEN_', '_R_CHECK_CRAN_INCOMING_', '_R_CHECK_CRAN_INCOMING_CHECK_FILE_URIS_', '_R_CHECK_CRAN_INCOMING_CHECK_URLS_IN_PARALLEL_', '_R_CHECK_CRAN_INCOMING_NOTE_GNU_MAKE_', '_R_CHECK_CRAN_INCOMING_REMOTE_', '_R_CHECK_CRAN_INCOMING_USE_ASPELL_', '_R_CHECK_DATALIST_', '_R_CHECK_DEPRECATED_DEFUNCT_', '_R_CHECK_DOC_SIZES2_', '_R_CHECK_DOT_FIRSTLIB_', '_R_CHECK_DOT_INTERNAL_', '_R_CHECK_EXAMPLE_TIMING_THRESHOLD_', '_R_CHECK_EXECUTABLES_', '_R_CHECK_EXECUTABLES_EXCLUSIONS_', '_R_CHECK_FF_CALLS_', '_R_CHECK_FF_DUP_', '_R_CHECK_FORCE_SUGGESTS_', '_R_CHECK_FUTURE_FILE_TIMESTAMPS_', '_R_CHECK_FUTURE_FILE_TIMESTAMPS_LEEWAY_', '_R_CHECK_HAVE_MYSQL_', '_R_CHECK_HAVE_ODBC_', '_R_CHECK_HAVE_PERL_', '_R_CHECK_HAVE_POSTGRES_', '_R_CHECK_INSTALL_DEPENDS_', '_R_CHECK_INTERNALS2_', '_R_CHECK_LENGTH_1_CONDITION_', '_R_CHECK_LICENSE_', '_R_CHECK_LIMIT_CORES_', '_R_CHECK_MATRIX_DATA_', '_R_CHECK_NATIVE_ROUTINE_REGISTRATION_', '_R_CHECK_NEWS_IN_PLAIN_TEXT_', '_R_CHECK_NO_RECOMMENDED_', '_R_CHECK_NO_STOP_ON_TEST_ERROR_', '_R_CHECK_ORPHANED_', '_R_CHECK_OVERWRITE_REGISTERED_S3_METHODS_', '_R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_', '_R_CHECK_PACKAGES_USED_IN_TESTS_USE_SUBDIRS_', '_R_CHECK_PACKAGE_DATASETS_SUPPRESS_NOTES_', '_R_CHECK_PACKAGE_NAME_', '_R_CHECK_PKG_SIZES_', '_R_CHECK_PKG_SIZES_THRESHOLD_', '_R_CHECK_PRAGMAS_', '_R_CHECK_RD_EXAMPLES_T_AND_F_', '_R_CHECK_RD_LINE_WIDTHS_', '_R_CHECK_RD_MATH_RENDERING_', '_R_CHECK_RD_VALIDATE_RD2HTML_', '_R_CHECK_REPLACING_IMPORTS_', '_R_CHECK_R_DEPENDS_', '_R_CHECK_S3_METHODS_SHOW_POSSIBLE_ISSUES_', '_R_CHECK_SCREEN_DEVICE_', '_R_CHECK_SERIALIZATION_', '_R_CHECK_SHLIB_OPENMP_FLAGS_', '_R_CHECK_SRC_MINUS_W_IMPLICIT_', '_R_CHECK_SUBDIRS_NOCASE_', '_R_CHECK_SUBDIRS_STRICT_', '_R_CHECK_SUGGESTS_ONLY_', '_R_CHECK_SYSTEM_CLOCK_', '_R_CHECK_TESTS_NLINES_', '_R_CHECK_TEST_TIMING_', '_R_CHECK_TIMINGS_', '_R_CHECK_TOPLEVEL_FILES_', '_R_CHECK_UNDOC_USE_ALL_NAMES_', '_R_CHECK_UNSAFE_CALLS_', '_R_CHECK_URLS_SHOW_301_STATUS_', '_R_CHECK_VC_DIRS_', '_R_CHECK_VIGNETTES_NLINES_', '_R_CHECK_VIGNETTES_SKIP_RUN_MAYBE_', '_R_CHECK_VIGNETTE_TIMING_', '_R_CHECK_VIGNETTE_TITLES_', '_R_CHECK_WINDOWS_DEVICE_', '_R_CHECK_XREFS_USE_ALIASES_FROM_CRAN_', '_R_CLASS_MATRIX_ARRAY_', '_R_INSTALL_TIME_PATCHES_', '_R_S3_METHOD_LOOKUP_BASEENV_AFTER_GLOBALENV_', '_R_SHLIB_BUILD_OBJECTS_SYMBOL_TABLES_', 'maj.version', 'nextArg--timingsnextArg--install' - Environment variables still there: [n=0] - Environment variables missing: [n=1] 'MAKEFLAGS' Differences environment variable by environment variable: List of 3 $ name : chr "MAKEFLAGS" $ expected: 'Dlist' chr "" $ actual : 'Dlist' chr NA > > proc.time() user system elapsed 0.93 0.10 2.45