Skip to contents

Get step information

Usage

pipe_get_step(pip, step)

pipe_get_step_names(pip)

pipe_get_step_number(pip, step)

pipe_has_step(pip, step)

Arguments

pip

Pipeline object

step

string name of step

Value

  • pipe_get_step: data.table row containing the step

  • pipe_get_step_names: character vector of step names

  • pipe_get_step_number: the step number in the pipeline

  • pipe_get_step_number: whether step exists

Examples

p <- pipe_new("pipe", data = 1:2)
pipe_add(p, "add1", \(data = ~data, x = 1) x + data)
pipe_add(p, "add2", \(x = 1, y = 2, z = ~add1) x + y + z)
pipe_run(p)
#> INFO  [2025-01-03 19:12:50.164] Start run of 'pipe' pipeline:
#> INFO  [2025-01-03 19:12:50.165] Step 1/3 data
#> INFO  [2025-01-03 19:12:50.167] Step 2/3 add1
#> INFO  [2025-01-03 19:12:50.169] Step 3/3 add2
#> INFO  [2025-01-03 19:12:50.170] Finished execution of steps.
#> INFO  [2025-01-03 19:12:50.171] Done.

# pipe_get_step_names
pipe_get_step_names(p)
#> [1] "data" "add1" "add2"

# get_step_number
pipe_get_step_number(p, "add1")
#> [1] 2
pipe_get_step_number(p, "add2")
#> [1] 3

# pipe_has_step
pipe_has_step(p, "add1")
#> [1] TRUE
pipe_has_step(p, "foo")
#> [1] FALSE

# pipe_get_step
add1 <- pipe_get_step(p, "add1")
add1
#>      step           fun funcName    params depends    out keepOut  group
#>    <char>        <list>   <char>    <list>  <list> <list>  <lgcl> <char>
#> 1:   add1 <function[1]> function <list[2]>    data    2,3   FALSE   add1
#>    description                time  state
#>         <char>              <POSc> <char>
#> 1:             2025-01-03 19:12:50   Done

add1[["params"]]
#> [[1]]
#> [[1]]$data
#> ~data
#> <environment: 0x000002422389c0f0>
#> 
#> [[1]]$x
#> [1] 1
#> 
#> 

add1[["fun"]]
#> [[1]]
#> function (data = ~data, x = 1) 
#> x + data
#> <environment: 0x0000024223a25c10>
#> 

try(p$get_step("foo")) # error: step 'foo' does not exist
#> Error : step 'foo' does not exist