Functions to define stages and their constituent steps.
The macros combine several steps and assign them to relevant
stages.
See dsl_get()
for functions to access the storage for the stages
and their steps.
get_stage()
returns a TicStage
object for a stage given by name.
This function can be called directly in the tic.R
configuration file,
which is processed by dsl_load()
.
add_step()
adds a step to a stage, see step_hello_world()
and the links therein for available steps.
add_code_step()
is a shortcut for add_step(step_run_code(...))
.
Arguments
- name
[string]
The name for the stage.- stage
[TicStage]
ATicStage
object as returned byget_stage()
.- step
[function]
An object of class TicStep, usually created by functions with thestep_
prefix likestep_hello_world()
.- call
[call]
An arbitrary R expression executed during the stage to which this step is added. The default is useful if you only passprepare_call
.- prepare_call
[call]
An optional arbitrary R expression executed during preparation.
Examples
dsl_init()
#> ✔ Creating a clean tic stage configuration
#> ℹ See `?tic::dsl_get` for details
get_stage("script")
#> ── Stage: script ───────────────────────────────────────────────────────────────
#> ℹ No steps defined
get_stage("script") %>%
add_step(step_hello_world())
get_stage("script")
#> ── Stage: script ───────────────────────────────────────────────────────────────
#> ▶ step_hello_world()
get_stage("script") %>%
add_code_step(print("Hi!"))
get_stage("script")
#> ── Stage: script ───────────────────────────────────────────────────────────────
#> ▶ step_hello_world()
#> ▶ step_run_code(print("Hi!"))