Given a branching pattern, use available metadata to reconstruct branch names and the names of each branch's dependencies. The metadata of each target must already exist and be consistent with the metadata of the other targets involved.

tar_branches(name, pattern)

Arguments

name

Symbol, name of the target.

pattern

Language to define branching for a target. For example, in a pipeline with numeric vector targets x and y, tar_target(z, x + y, pattern = map(x, y)) implicitly defines branches of z that each compute x[1] + y[1], x[2] + y[2], and so on. See the user manual for details.

Value

A tibble with one row per branch and one column for each target (including the branched-over targets and the target with the pattern.)

Details

The results from this function can help you retroactively figure out correspondences between upstream branches and downstream branches. However, it does not always correctly predict what the names of the branches will be after the next run of the pipeline. Dynamic branching happens while the pipeline is running, so we cannot always know what the names of the branches will be in advance (or even how many there will be).

Examples

if (identical(Sys.getenv("TAR_LONG_EXAMPLES"), "true")) { tar_dir({ # tar_dir() runs code from a temporary directory. tar_script({ list( tar_target(x, seq_len(2)), tar_target(y, head(letters, 2)), tar_target(z, head(LETTERS, 2)), tar_target(dynamic, c(x, y, z), pattern = cross(z, map(x, y))) ) }, ask = FALSE) tar_make() tar_branches(dynamic, pattern = cross(z, map(x, y))) }) }