Closed HenrikBengtsson closed 1 year ago
One thing that updates the RNG state is batchtools::makeRegistry()
. It does so in two places; first to generate a random seed
, unless argument seed
is specified. However, later on it also calls batchtools:::rnd_hash()
, which also update the RNG state.
Added test to future.tests that checks for this:
── Settings ────────────────────────────────────────────────────────────────────
- future.tests version : 0.4.0.9001
- R_FUTURE_TESTS_ROOT :
- Option 'future.tests.root': NULL
- Default test set folder : /home/hb/R/x86_64-pc-linux-gnu-library/4.2-CBI-gcc9/future.tests/test-db
- Max number of workers : 2
- Timeout : N/A
── Running 50 test sets with plan(future.batchtools::batchtools_local) ─────────
ℹ Backend package: future.batchtools 0.10.0.9020
…
- ✔ Random Number Generation (RNG) - %<-% (2 tests) (18.4s)
✖ Orchestration Stability - future() does not update RNG state (1 test) (965ms)
✖ lazy=FALSE, globals=TRUE, stdout=TRUE
✖ Orchestration Stability - result() does not update RNG state (1 test) (2s)
- ✖ lazy=FALSE, globals=TRUE, stdout=TRUE
✖ Orchestration Stability - value() does not update RNG state (1 test) (3.1s)
✖ lazy=FALSE, globals=TRUE, stdout=TRUE
The following calls in run()
updates the RNG state:
batchtools::makeRegistry()
temp_registry()
batchtools::batchMap()
(because it calls saveRegistry()
which calls rnd_hash()
).batchtools::submitJobs()
Something updates
.Random.seed
when a future is launched, checked, and collected, e.g.