Loads specified preload lists to verify execution, saves the state to the
specified zip file and attempts to load the saved state if
test_save_state is TRUE. To test a workflow you can use
sources to specify the loading of data and then workflow to
specify the yaml workflow.
Arguments
- sources
Vector of at corresponds with the ID used to call the modules UI elements
- preload_files
Dataframe of files needed to run the workflow with a column called
srcfor the local source of the file anddestfor the destination. Not strictly required but almost always needed.- preload_dir
Directory to run out of (
tempdir())- save_state_file
When testing `ASM_save_state()` this is the file name where the stat will be written (
tempfile(fileext=".zip"))- test_save_state
Logical when set to
TRUE(default) it will test the zip file (save_state_file) to make sure it can be loaded.- workflow
Yaml preload file to run a workflow (optional,
NULLdefault).
Value
list with the following elements
isgood: Boolean indicating the exit status of the function.
msgs: Messages to be passed back to the user.
apl_res: Results from FM_app_preload() if run,
list(isgood=FALSE, msgs="not run")otherwise.ss_res: Results from ASM_save_state() if run,
list(isgood=FALSE, msgs="not run")otherwise.ls_res: Results from ASM_load_state() if run,
list(isgood=FALSE, msgs="not run")otherwise.rwf_res: Results from ASM_run_workflow() if run,
list(isgood=FALSE, msgs="not run")otherwise.save_state_file: If ss_res$isgood is TRUE this is the path to the zip file generated when saving the app state after loading.
Examples
sources = c(
system.file(package="formods", "preload", "UD_preload.yaml"),
system.file(package="formods", "preload", "ASM_preload.yaml"))
res = ASM_test_preload(sources=sources, test_save_state = FALSE)
#> ✖ Module UD, mod_yaml does not exist: config/UD.yaml
#> ✖ Module UD, fm_yaml does not exist: config/formods.yaml
#> ✖ Module ASM, mod_yaml does not exist: config/ASM.yaml
#> ✖ Module ASM, fm_yaml does not exist: config/formods.yaml
#> → # preload_complete is good: FALSE -----------------------------------------
#> → # Module UD, mod_yaml does not exist: config/UD.yaml
#> → # Module UD, fm_yaml does not exist: config/formods.yaml
#> → # Module ASM, mod_yaml does not exist: config/ASM.yaml
#> → # Module ASM, fm_yaml does not exist: config/formods.yaml
#> ! FM_test_preload()
#> ! FM_app_preload() failed
#> ! Module UD, mod_yaml does not exist: config/UD.yaml
#> ! Module UD, fm_yaml does not exist: config/formods.yaml
#> ! Module ASM, mod_yaml does not exist: config/ASM.yaml
#> ! Module ASM, fm_yaml does not exist: config/formods.yaml
res$isgood
#> [1] FALSE
