Skip to contents

Called from download handler and used to write a saved state value if that is null

Usage

ASM_run_workflow(state, session, wfl)

Arguments

state

ASM state from ASM_fetch_state()

session

Shiny session variable

wfl

List contining details about the workflow

Value

The ASM state object with the results stored as a list in the field rwf_res following elements:

  • isgood: Boolean indicating the exit status of the function.

  • msgs: Messages to be passed back to the user.

  • react_state: Reaction state initilized after loading

Examples

# Populating the session with data
session = list()
ds_plf = c(system.file(package="formods", "preload", "ASM_preload_empty.yaml"),
           system.file(package="formods", "preload", "UD_preload.yaml"),
           system.file(package="formods", "preload", "DM_preload_empty.yaml"))
session = list()
res_ds = FM_app_preload(session=session, sources=ds_plf)
#>  Module UD, mod_yaml does not exist: config/UD.yaml
#>  Module UD, 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

session = res_ds[["session"]]
state   = res_ds[["all_sess_res"]][["ASM"]][["state"]]

# Creating the workflow preload list
wf_pll = c(
  FM_read_yaml( system.file(package="formods", "preload", "ASM_preload.yaml")),
  FM_read_yaml( system.file(package="formods", "preload", "UD_preload.yaml")),
  FM_read_yaml( system.file(package="formods", "preload", "DM_preload_empty.yaml")),
  FM_read_yaml( system.file(package="formods", "preload", "DW_preload_empty.yaml")))

tmp_preload = tempfile(fileext=".yaml")
yaml::write_yaml(file=tmp_preload, x=wf_pll)

wfl = list(
  require_ds = TRUE,
  preload   = tmp_preload
)

# Running the workflow
state = ASM_run_workflow(state=state, session=session, wfl=wfl)

state$ASM$rwf_res
#> $isgood
#> [1] FALSE
#> 
#> $react_state
#> list()
#> 
#> $msgs
#> NULL
#>