diff --git a/DESCRIPTION b/DESCRIPTION index 5d5cbc8..997a5ff 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -10,8 +10,8 @@ Description: Tools to do simulation experiments within the SpaDES ecosystem. URL: https://spades-experiment.predictiveecology.org/, https://github.com/PredictiveEcology/SpaDES.experiment -Date: 2021-08-19 -Version: 0.0.2.9003 +Date: 2022-09-10 +Version: 0.0.2.9004 Authors@R: c( person("Eliot J B", "McIntire", email = "eliot.mcintire@canada.ca", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-6914-8316")), diff --git a/R/experiment2.R b/R/experiment2.R index 453a60a..ca5f1a7 100644 --- a/R/experiment2.R +++ b/R/experiment2.R @@ -78,6 +78,7 @@ setGeneric( }) #' @importFrom future.apply future_lapply future_mapply +#' @importFrom future nbrOfWorkers #' @importFrom googledrive drive_auth #' @importFrom SpaDES.core packages #' @rdname experiment2 @@ -127,6 +128,7 @@ setMethod( staggersInSecs <- cumsum(c(0, rnorm(length(nbrOfWorkers())-1, mean = meanStaggerIntervalInSecs, sd = meanStaggerIntervalInSecs/10))) + allOpts <- options() out <- future_mapply( name = namsExpanded, simName = simNames, @@ -136,6 +138,7 @@ setMethod( createUniquePaths = createUniquePaths, useCache = useCache, .spades = .spades, + allOpts = allOpts, debug = debug, drive_auth_account = drive_auth_account), FUN = experiment2Inner, @@ -151,7 +154,7 @@ setMethod( #' @importFrom SpaDES.core outputPath outputPath<- envir #' @importFrom reproducible Cache experiment2Inner <- function(sim, clearSimEnv, staggerInSecs, createUniquePaths, - simName, name, useCache = FALSE, + simName, name, useCache = FALSE, allOpts, debug = getOption("spades.debug"), drive_auth_account, ...) { message(paste0("Sleeping ", round(staggerInSecs, 1), " seconds")) @@ -161,8 +164,10 @@ experiment2Inner <- function(sim, clearSimEnv, staggerInSecs, createUniquePaths, if (!is.null(drive_auth_account)) drive_auth(drive_auth_account) + options(allOpts) s <- Cache(.spades, sim, useCache = useCache, simName, - debug = debug, clearSimEnv = clearSimEnv, ..., omitArgs = "debug") + debug = debug, clearSimEnv = clearSimEnv, + ..., omitArgs = "debug") s } @@ -178,6 +183,7 @@ experiment2Inner <- function(sim, clearSimEnv, staggerInSecs, createUniquePaths, b <- Sys.time() message(format(b - a), " to Copy") } + s <- spades(sim, debug = debug, ...) if (isTRUE(clearSimEnv)) rm(list = ls(s, all.names = TRUE), envir = envir(s))