stageRunner_around: Wrap a function around a stageRunner's terminal nodes

Description Usage Arguments Details

Description

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.

Usage

1
stageRunner_around(other_runner)

Arguments

other_runner

stageRunner. Another stageRunner from which to create an around procedure. Alternatively, we could give a function or a list of functions.

Details

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.


syberia/stagerunner documentation built on May 30, 2019, 10:41 p.m.