intercept_baton | R Documentation |
Functionally similar to grab_baton
but able to obtain baton before the pass operation is complete.
intercept_baton(baton, loc = NULL, reset_only = FALSE, env = .GlobalEnv)
baton |
R object of S3 class, created by |
loc |
Location of YAML file that was saved from a baton. |
reset_only |
boolean value which will attempt only to reset the |
env |
R environment to locate and delete duplicate batons during an interception; defaults to |
Normally, grab_baton
is the preferred method to load a baton. However, there are circumstances where a pass
needs to be intercepted mid-pass so that a process can reset and continue. It is recommended to use intercept_baton
in
limited situations. To avoid loading a baton twice, intercept_baton
will attempt to delete any baton in the global environment
that shares the same ID; this is a measure to ensure a baton is only being acted on linearly. A warning is also provided to remind users that
misuse of this function could lead to unexpected results in the YAML file if a pass that was expected to be completed was intercepted and acted
upon differently.
S3 class object.
## Not run:
# Make a baton
baton_raw <- create_baton(bundled = TRUE,
bundle_params = list(dir = '/path/to/relay/raw_bundle',
tree = c('raw', 'processed', 'metadata', 'output')))
# Pass an empty baton for illustrative purposes
baton_raw <- relay::pass_baton(baton_raw)
# Grab the baton (if later in the script)
baton_raw <- relay::intercept_baton(baton_raw)
# Grab the baton (if in an entirely separate script/project)
baton_raw <- relay::intercept_baton(loc = '/path/to/original/baton')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.