A locker is a directory structure where an enclosing folder contains subfolders that in turn contain the results of different simulation runs. When the number of simulation result sets is known, a stream of file names is returned. This function is mainly called by other functions; an exported function and documentation is provided in order to better communicate how the locker works.
Arguments
- where
The directory that contains tagged directories of run results.
- tag
The name of a folder under
where; this directory must not exist the first time the locker is set up and will be deleted and re-created each time it is used to store output from a new simulation run.- ask
If
TRUE, thenconfig_locker()will be called on the locker space; once this is called, all future attempts to reset the locker contents will require user confirmation viautils::askYesNo(); theaskrequirement can be revoked by callingconfig_locker().- noreset
If
TRUEthenconfig_locker()will be called on the locker directory withnoreset = TRUEto prevent future resets; note that this is essentially a dead end; there is no way to make the locker space writable using public api; use this option if you really want to safeguard the output and assume complete control over the fate of these files.
Details
The user is encouraged to read the documentation and understand the ask
and noreset arguments. These may be important tools for you to use to
ensure the safety of outputs stored in locker space.
where must exist when setting up the locker. The directory tag will be
created under where and must not exist except if it had previously been
set up using setup_locker. Existing tag directories will have a
hidden file in them indicating that they are established simulation output
folders.
When recreating the tag directory, it will be unlinked and created new.
To not try to set up a locker directory that already contains outputs that
need to be preserved. You can call config_locker() on that directory
with noreset = TRUE to prevent future resets.
Examples
x <- setup_locker(tempdir(), tag = "my-sims")
x
#> [1] "/var/folders/5w/2ky5lwcj1zq7kyk4c3zg3zpw0000gp/T//Rtmpx1IZit/my-sims"