Skip to content

Commit 22087b0

Browse files
committed
Convergence_Plot: Temp fix for parallel
1 parent a567ee3 commit 22087b0

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

R/Mod_Convergence_Plot.R

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,9 @@ Convergence_Plot <- function(
635635
on.exit(try(snow::stopCluster(c1), silent = TRUE), add = TRUE)
636636
future::plan("future::cluster", workers = c1, gc = TRUE)
637637
on.exit(future::plan("future::sequential", gc = TRUE), add = TRUE)
638+
639+
future::future_log("future.log") # Log parallel execution ##
640+
638641
} else {
639642
future::plan("future::sequential", gc = TRUE)
640643
}
@@ -686,8 +689,7 @@ Convergence_Plot <- function(
686689
x = Iter, y = Value, color = factor(Chain))) +
687690
ggplot2::geom_line(linewidth = 0.15, alpha = 0.6) +
688691
ggplot2::geom_smooth(
689-
method = "loess", formula = y ~ x,
690-
se = FALSE, linewidth = 0.8) +
692+
method = "loess", formula = y ~ x, se = FALSE, linewidth = 0.8) +
691693
ggplot2::geom_point(alpha = 0) +
692694
ggplot2::geom_hline(
693695
yintercept = CurrCI, linetype = "dashed", color = "black",
@@ -764,12 +766,13 @@ Convergence_Plot <- function(
764766
return(tibble::tibble(Var_Sp = Var_Sp, Plot_File = Plot_File))
765767
},
766768
.options = furrr::furrr_options(
767-
seed = TRUE, scheduling = Inf,
769+
seed = TRUE, scheduling = 1,
768770
globals = c(
769771
"Beta_DF", "NChains", "SampleSize", "Cols", "MarginType",
770772
"VarsDesc", "CurrCI"),
771773
packages = c(
772-
"dplyr", "ggplot2", "ggtext", "magrittr", "coda", "IASDT.R"))) %>%
774+
"dplyr", "ggplot2", "ggtext", "magrittr", "stringr", "ggExtra",
775+
"coda", "IASDT.R", "qs2", "tibble"))) %>%
773776
dplyr::bind_rows() %>%
774777
dplyr::left_join(Beta_DF, ., by = "Var_Sp") %>%
775778
dplyr::left_join(VarsDesc, by = "Variable")
@@ -1043,7 +1046,7 @@ Convergence_Plot <- function(
10431046
return(NULL)
10441047
},
10451048
.options = furrr::furrr_options(
1046-
seed = TRUE, scheduling = Inf,
1049+
seed = TRUE, scheduling = 1,
10471050
globals = c(
10481051
"BetaTracePlots_ByVar", "NRC", "Path_Convergence", "VarDesc"),
10491052
packages = c(
@@ -1264,7 +1267,7 @@ Convergence_Plot <- function(
12641267

12651268
},
12661269
.options = furrr::furrr_options(
1267-
seed = TRUE, scheduling = Inf,
1270+
seed = TRUE, scheduling = 1,
12681271
globals = c(
12691272
"MarginType", "BetaTracePlots_BySp", "Path_Convergence_BySp",
12701273
"Beta_NRC"),
@@ -1346,7 +1349,7 @@ Convergence_Plot <- function(
13461349
# rm(PlotTitle, envir = environment())
13471350
# return(invisible(NULL))
13481351
# },
1349-
# future.scheduling = Inf, future.seed = TRUE,
1352+
# future.scheduling = 1, future.seed = TRUE,
13501353
# future.globals = c(
13511354
# "MarginType", "BetaTracePlots_BySp", "Path_Convergence_BySp", "Beta_NRC"),
13521355
# future.packages = c("dplyr", "coda", "ggplot2", "ggExtra", "ggtext"))

0 commit comments

Comments
 (0)