Skip to contents

Locking a step means that both its parameters and its output (given it has output) are locked such that neither setting new pipeline parameters nor future pipeline runs can change the current parameter and output content. To unlock a locked step, use pipe_unlock_step().

Usage

pipe_lock_step(pip, step)

pipe_unlock_step(pip, step)

Arguments

pip

Pipeline object

step

string name of step to lock or unlock

Value

the Pipeline object invisibly

Examples

# pipe_lock_step
p <- pipe_new("pipe", data = 1)
pipe_add(p, "add1", \(x = 1, data = ~data) x + data)
pipe_add(p, "add2", \(x = 1, data = ~data) x + data)
pipe_run(p)
#> INFO  [2025-01-03 19:12:43.300] Start run of 'pipe' pipeline:
#> INFO  [2025-01-03 19:12:43.301] Step 1/3 data
#> INFO  [2025-01-03 19:12:43.303] Step 2/3 add1
#> INFO  [2025-01-03 19:12:43.305] Step 3/3 add2
#> INFO  [2025-01-03 19:12:43.306] Finished execution of steps.
#> INFO  [2025-01-03 19:12:43.307] Done.
pipe_get_out(p, "add1")
#> [1] 2
pipe_get_out(p, "add2")
#> [1] 2
pipe_lock_step(p, "add1")

pipe_set_data(p, 3)
pipe_set_params(p, list(x = 3))
#> skipping setting parameters x at locked step 'add1'
pipe_run(p)
#> INFO  [2025-01-03 19:12:43.315] Start run of 'pipe' pipeline:
#> INFO  [2025-01-03 19:12:43.316] Step 1/3 data
#> INFO  [2025-01-03 19:12:43.318] Step 2/3 add1 - skip 'locked' step
#> INFO  [2025-01-03 19:12:43.319] Step 3/3 add2
#> INFO  [2025-01-03 19:12:43.320] Finished execution of steps.
#> INFO  [2025-01-03 19:12:43.321] Done.
pipe_get_out(p, "add1")
#> [1] 2
pipe_get_out(p, "add2")
#> [1] 6

# pipe_unlock_step
pipe_unlock_step(p, "add1")
pipe_set_params(p, list(x = 3))
pipe_run(p)
#> INFO  [2025-01-03 19:12:43.330] Start run of 'pipe' pipeline:
#> INFO  [2025-01-03 19:12:43.332] Step 1/3 data - skip 'done' step
#> INFO  [2025-01-03 19:12:43.333] Step 2/3 add1
#> INFO  [2025-01-03 19:12:43.335] Step 3/3 add2
#> INFO  [2025-01-03 19:12:43.336] Finished execution of steps.
#> INFO  [2025-01-03 19:12:43.337] Done.
pipe_get_out(p, "add1")
#> [1] 6