If we want to execute some behavior just before and just after executing terminal nodes in a stageRunner, a solution without this method would be to overlay two runners -- one before and one after. However, this is messy, so this function is intended to replace this approach with just one function.
stageRunner_around(other_runner)
other_runner | stageRunner. Another stageRunner from which to create an around procedure. Alternatively, we could give a function or a list of functions. |
---|
Consider the runner
sr1 <- stageRunner$new(some_env, list(a = function(e) print('2')))
If we run
sr2 <- stageRunner$new(some_env, list(a = function(e) {
print('1'); yield(); print('3') }))
sr1$around(sr2)
sr1$run()
then we will see 1, 2, and 3 printed in succession. The yield()
keyword is used to specify when to execute the terminal node that
is sandwiched in the "around" runner.