Functions to check ownership or disown simulation output files on disk.
One situation where you need to take over ownership is when you are
simulating in parallel, and the simulation happens in another R process.
mrgsim.ds ownership is established when the simulation returns and the
mrgsimsds object is created. When this happens in another R process (e.g.,
on a worker node), there is no way to transfer that information back to the
parent process. In that case, a call to take_ownership() once the results
are returned to the parent process would be appropriate. Typically, these
results are returned as a list and a call to reduce_ds() will create a
single object pointing to and owning multiple files. Therefore, it should be
rare to call take_ownership() directly; if doing so, please make sure you
understand what is going on.
Value
check_ownership:TRUEifxowns the underlying files;FALSEotherwise.list_ownership: a data.frame of ownership information.ownership: nothing; used for side effects.disown:xis returned invisibly; it is not modified.take_ownership:xis returned invisibly after its hash and the package-level ownership maps are updated in place.
Examples
mod <- house_ds()
out <- mrgsim_ds(mod, id = 1)
check_ownership(out)
#> [1] TRUE
ownership()
#> > Objects: 5 | Files: 5 | Size: 385.7 Kb
list_ownership()
#> file address
#> 1 mrgsims-ds-19173e2de442.parquet 0x55ad63cb1060
#> 2 mrgsims-ds-19174e9d507b.parquet 0x55ad640ff968
#> 3 mrgsims-ds-19177aa7a80.parquet 0x55ad63eb2df8
#> 4 mrgsims-ds-1917424a1f3a.parquet 0x55ad58617c88
#> 5 mrgsims-ds-1917c09c419.parquet 0x55ad634ebe70
e1 <- ev(amt = 100)
e2 <- ev(amt = 200)
out <- list(mrgsim_ds(mod, e1), mrgsim_ds(mod, e2))
sims <- reduce_ds(out)
ownership()
#> > Objects: 6 | Files: 7 | Size: 439 Kb
check_ownership(sims)
#> [1] TRUE
check_ownership(out[[1]])
#> [1] FALSE
check_ownership(out[[2]])
#> [1] FALSE