Skip to content

Commit

Permalink
export correct context
Browse files Browse the repository at this point in the history
  • Loading branch information
philchalmers committed Feb 6, 2025
1 parent 5190306 commit 7b14349
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion R/SimSolve.R
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,8 @@ SimSolve <- function(design, interval, b, generate, analyse, summarise,
on.exit(parallel::stopCluster(cl), add = TRUE)
}
if(!useFuture){
parallel::clusterExport(cl=cl, export_funs, envir = parent.frame(1L))
parallel::clusterExport(cl=cl, export_funs,
envir = parent.frame(control$global_fun_level-1))
parallel::clusterExport(cl=cl, "ANALYSE_FUNCTIONS", envir = environment())
if(verbose > 0 && verbose < 2)
message(sprintf("\nNumber of parallel clusters in use: %i", length(cl)))
Expand Down
3 changes: 2 additions & 1 deletion R/runSimulation.R
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,8 @@ runSimulation <- function(design, replications, generate, analyse, summarise,
on.exit(parallel::stopCluster(cl), add = TRUE)
}
if(!useFuture){
parallel::clusterExport(cl=cl, export_funs, envir = parent.frame(1L))
parallel::clusterExport(cl=cl, export_funs,
envir = parent.frame(control$global_fun_level-1))
parallel::clusterExport(cl=cl, "ANALYSE_FUNCTIONS", envir = environment())
parallel::clusterExport(cl=cl, "TRY_ALL_ANALYSE", envir = environment())
if(verbose)
Expand Down

0 comments on commit 7b14349

Please sign in to comment.