tar_network {targets} | R Documentation |
Return the vertices and edges of a pipeline dependency graph.
Description
Analyze the pipeline defined in the target script file
(default: _targets.R
)
and return the vertices and edges of the directed acyclic graph
of dependency relationships.
Usage
tar_network(
targets_only = FALSE,
names = NULL,
shortcut = FALSE,
allow = NULL,
exclude = NULL,
outdated = TRUE,
reporter = targets::tar_config_get("reporter_outdated"),
seconds_reporter = targets::tar_config_get("seconds_reporter"),
callr_function = callr::r,
callr_arguments = targets::tar_callr_args_default(callr_function, reporter),
envir = parent.frame(),
script = targets::tar_config_get("script"),
store = targets::tar_config_get("store")
)
Arguments
targets_only |
Logical, whether to restrict the output to just targets
( |
names |
Names of targets. The graph visualization will operate
only on these targets (and unless |
shortcut |
Logical of length 1, how to interpret the |
allow |
Optional, define the set of allowable vertices in the graph.
Unlike |
exclude |
Optional, define the set of exclude vertices from the graph.
Unlike |
outdated |
Logical, whether to show colors to distinguish outdated
targets from up-to-date targets. (Global functions and objects
still show these colors.) Looking for outdated targets
takes a lot of time for large pipelines with lots of branches,
and setting |
reporter |
Character of length 1, name of the reporter to user. Controls how messages are printed as targets are checked. Choices:
|
seconds_reporter |
Positive numeric of length 1 with the minimum number of seconds between times when the reporter prints progress messages to the R console. |
callr_function |
A function from |
callr_arguments |
A list of arguments to |
envir |
An environment, where to run the target R script
(default: The |
script |
Character of length 1, path to the
target script file. Defaults to |
store |
Character of length 1, path to the
|
Value
A list with two data frames: vertices
and edges
. The
vertices data frame has one row per target and columns with the
the type of the target or object (stem, branch, map, cross, function,
or object), each target's description, and each target's status
(up to date, outdated, dispatched, completed, canceled, or errored),
as well as metadata if available (seconds of runtime, bytes of
storage, and number of dynamic branches).
The edges data frame has one row for every edge and columns to
and
from
to mark the starting and terminating vertices.
Dependency graph
The dependency graph of a pipeline is a directed acyclic graph (DAG)
where each node indicates a target or global object and each directed
edge indicates where a downstream node depends on an upstream node.
The DAG is not always a tree, but it never contains a cycle because
no target is allowed to directly or indirectly depend on itself.
The dependency graph should show a natural progression of work from
left to right. targets
uses static code analysis to create the graph,
so the order of tar_target()
calls in the _targets.R
file
does not matter. However, targets does not support self-referential
loops or other cycles. For more information on the dependency graph,
please read
https://books.ropensci.org/targets/targets.html#dependencies.
See Also
Other inspect:
tar_deps()
,
tar_deps_raw()
,
tar_manifest()
,
tar_outdated()
,
tar_sitrep()
,
tar_validate()
Examples
if (identical(Sys.getenv("TAR_EXAMPLES"), "true")) { # for CRAN
tar_dir({ # tar_dir() runs code from a temp dir for CRAN.
tar_script({
tar_option_set()
list(
tar_target(y1, 1 + 1),
tar_target(y2, 1 + 1, description = "y2 info"),
tar_target(z, y1 + y2, description = "z info")
)
}, ask = FALSE)
tar_network(targets_only = TRUE)
})
}