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.

Examples

# Populating the session with data
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)
#> → ASM: including file
#> → ASM:   source: file.path(system.file(package="onbrand"), "templates", "report.docx")
#> → ASM:   dest:   file.path("config","report.docx")
#> → ASM: including file
#> → ASM:   source: file.path(system.file(package="onbrand"), "templates", "report.pptx")
#> → ASM:   dest:   file.path("config","report.pptx")
#> → ASM: including file
#> → ASM:   source: file.path(system.file(package="onbrand"), "templates", "report.yaml")
#> → ASM:   dest:   file.path("config","report.yaml")
#> → ASM: State initialized
#> → ASM: setting word placeholders: 
#> → ASM:   -> setting docx ph: HEADERLEFT = left header
#> → ASM:   -> setting docx ph: HEADERRIGHT = right header
#> → ASM:   -> setting docx ph: FOOTERLEFT = left footer
#> → ASM: module isgood: TRUE
#> → UD: including file
#> → UD:   source: file.path(system.file(package="onbrand"), "templates", "report.docx")
#> → UD:   dest:   file.path("config","report.docx")
#> → UD: including file
#> → UD:   source: file.path(system.file(package="onbrand"), "templates", "report.pptx")
#> → UD:   dest:   file.path("config","report.pptx")
#> → UD: including file
#> → UD:   source: file.path(system.file(package="onbrand"), "templates", "report.yaml")
#> → UD:   dest:   file.path("config","report.yaml")
#> → UD: State initialized
#> → UD: module checksum updated:897d952fecbc804999396a96f9df4b20
#> → UD: module isgood: TRUE
#> → DM: including file
#> → DM:   source: file.path(system.file(package="onbrand"), "templates", "report.docx")
#> → DM:   dest:   file.path("config","report.docx")
#> → DM: including file
#> → DM:   source: file.path(system.file(package="onbrand"), "templates", "report.pptx")
#> → DM:   dest:   file.path("config","report.pptx")
#> → DM: including file
#> → DM:   source: file.path(system.file(package="onbrand"), "templates", "report.yaml")
#> → DM:   dest:   file.path("config","report.yaml")
#> → DM: module checksum updated: f280116ab6b4488df6de76aff513a83f
#> → DM: State initialized
#> → DM: ds checksum updated: 641fcbc6616d24d05acded4317a3bb12
#> → DM: module checksum updated: 78099100dae67cc0fee50517ea72a920
#> → DM: module isgood: TRUE
#> → # preload_complete is good: TRUE ------------------------------------------

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)
#> → ASM: Running workflow: 
#> → UD: mk_preload isgood: TRUE
#> → DM: mk_preload isgood: TRUE
#> → ASM: writing app state to file on server: 
#> → ASM:   /var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T//Rtmp8ZXiwp/fileb567542410cc.zip
#> → ASM: Generating reports (code only)
#> → ASM:   Generating report: xlsx
#> → ASM:     appending report for module:DM id:DM priority:1
#> → ASM:   Generating report: pptx
#> → ASM:     appending report for module:DM id:DM priority:1
#> → ASM:   Generating report: docx
#> → ASM:     appending report for module:DM id:DM priority:1
#> → ASM: done writing app state
#> → ASM: including file
#> → ASM:   source: file.path(system.file(package="onbrand"), "templates", "report.docx")
#> → ASM:   dest:   file.path("config","report.docx")
#> → ASM: including file
#> → ASM:   source: file.path(system.file(package="onbrand"), "templates", "report.pptx")
#> → ASM:   dest:   file.path("config","report.pptx")
#> → ASM: including file
#> → ASM:   source: file.path(system.file(package="onbrand"), "templates", "report.yaml")
#> → ASM:   dest:   file.path("config","report.yaml")
#> → ASM: State initialized
#> → ASM: setting word placeholders: 
#> → ASM:   -> setting docx ph: HEADERLEFT = left header
#> → ASM:   -> setting docx ph: HEADERRIGHT = right header
#> → ASM:   -> setting docx ph: FOOTERLEFT = left footer
#> → ASM: module isgood: TRUE
#> → DM: including file
#> → DM:   source: file.path(system.file(package="onbrand"), "templates", "report.docx")
#> → DM:   dest:   file.path("config","report.docx")
#> → DM: including file
#> → DM:   source: file.path(system.file(package="onbrand"), "templates", "report.pptx")
#> → DM:   dest:   file.path("config","report.pptx")
#> → DM: including file
#> → DM:   source: file.path(system.file(package="onbrand"), "templates", "report.yaml")
#> → DM:   dest:   file.path("config","report.yaml")
#> → DM: module checksum updated: f280116ab6b4488df6de76aff513a83f
#> → DM: State initialized
#> → DM: ds checksum updated: 641fcbc6616d24d05acded4317a3bb12
#> → DM: module checksum updated: 78099100dae67cc0fee50517ea72a920
#> → DM: module isgood: TRUE
#> → UD: including file
#> → UD:   source: file.path(system.file(package="onbrand"), "templates", "report.docx")
#> → UD:   dest:   file.path("config","report.docx")
#> → UD: including file
#> → UD:   source: file.path(system.file(package="onbrand"), "templates", "report.pptx")
#> → UD:   dest:   file.path("config","report.pptx")
#> → UD: including file
#> → UD:   source: file.path(system.file(package="onbrand"), "templates", "report.yaml")
#> → UD:   dest:   file.path("config","report.yaml")
#> → UD: State initialized
#> → UD: module checksum updated:897d952fecbc804999396a96f9df4b20
#> → UD: module isgood: TRUE
#> → DW: including file
#> → DW:   source: file.path(system.file(package="onbrand"), "templates", "report.docx")
#> → DW:   dest:   file.path("config","report.docx")
#> → DW: including file
#> → DW:   source: file.path(system.file(package="onbrand"), "templates", "report.pptx")
#> → DW:   dest:   file.path("config","report.pptx")
#> → DW: including file
#> → DW:   source: file.path(system.file(package="onbrand"), "templates", "report.yaml")
#> → DW:   dest:   file.path("config","report.yaml")
#> → DW: data view checksum updated: 
#> → DW:   old: 
#> → DW:   new: e19ddb59715ba77afdd1907053aa5d14
#> → DW: module checksum updated:a9496b622f92f683cc8c69f65ac1ece4
#> → DW: State initialized
#> → DW: module isgood: TRUE
#> → # preload_complete is good: TRUE ------------------------------------------
#> → ASM: post-processing state for module: ASM id: ASM
#> → ASM:   -> running ASM_onload() for module id: ASM
#> → ASM: post-processing state for module: DM id: DM
#> → ASM:   -> running DM_onload() for module id: DM
#> → ASM: post-processing state for module: UD id: UD
#> → ASM: post-processing state for module: DW id: DW