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-1a4e534eb673.parquet 0x55b3c02c9be0
#> 2 mrgsims-ds-1a4e5d64b66b.parquet 0x55b3c0b29118
#> 3 mrgsims-ds-1a4e60c8511c.parquet 0x55b3c4aee8a0
#> 4 mrgsims-ds-1a4e760f5168.parquet 0x55b3c3abdea8
#> 5 mrgsims-ds-1a4e58bcdc7a.parquet 0x55b3c2c34408
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