metrumresearchgroup / bbr

R interface for model and project management
https://metrumresearchgroup.github.io/bbr/
Other
21 stars 2 forks source link

Bootstrap runs should inherit attached bbi_args #682

Closed seth127 closed 3 weeks ago

seth127 commented 2 months ago

For users wanting to parallelize each individual model run, a common approach is to attach bbi_args to the model object. Bootstrap runs should inherit these settings so that, by default, they run with the same parallelization settings as the run they were generated from.

.m <- read_model(...) %>% add_bbi_args(list(threads = 4, parallel = TRUE))
print(.m$bbi_args)
# $threads
# [1] 4
# 
# $parallel
# [1] TRUE

.boot <- new_bootstrap_run(.m)
print(.boot$bbi_args)
# $threads
# [1] 4
# 
# $parallel
# [1] TRUE
### this ^ is good

.boot <- setup_bootstrap_run(.boot, n = 10, seed = 1234)
.bm1 <- get_boot_models(.boot)[[1]]
.bm1$bbi_args
# NULL
### this ^ is not good
seth127 commented 2 months ago

This was implemented in https://github.com/metrumresearchgroup/bbr/pull/671/commits/4bcc36b199e92b97585024ed68ed25c3481b0da3 but let's leave this open until we've added tests and merged that PR to main