orderly_graph {orderly}R Documentation

Print the dependency tree for a given report using orderly log

Description

Investigate the dependency structure in a set of orderly reports. This function allows the dependency graph to be created for set of reports that have been run and committed (the archive) or of a set of reports that could be run (the src) to be discovered and printed to screen. This is experimental and somewhat subject to change and improvement.

Usage

orderly_graph(
  name,
  id = "latest",
  root = NULL,
  locate = TRUE,
  direction = "downstream",
  propagate = TRUE,
  max_depth = Inf,
  recursion_limit = 100,
  show_all = FALSE,
  use = "archive"
)

Arguments

name

the name of the report

id

the id of the report, if omitted, use the id of the latest report

root

The path to an orderly root directory, or NULL (the default) to search for one from the current working directory if locate is TRUE.

locate

Logical, indicating if the configuration should be searched for. If TRUE and config is not given, then orderly looks in the working directory and up through its parents until it finds an orderly_config.yml file.

direction

A string indicating if we want to move up or down the tree permitted values are upstream, downstream

propagate

A boolean indicating if we want to propagate out of date through the tree

max_depth

A numeric, how far back should the tree go, this can be useful to truncate a very large tree. (default = Inf)

recursion_limit

A numeric, limit for depth of tree, if the tree goes beyond this then an error is thrown. (default = 100)

show_all

A boolean, should we show all reports in the tree, not just the latest.

use

Character string indicating what we read to infer the dependency tree. Current valid values are archive (the default), which reads from archive reports and src which reads from the source reports.

Details

orderly allows a report to rely on the artefacts of one or more other orderly reports. This allows users to develop a network of interconnected reports where the output from report becomes the source of data for another. There are two natural questions that can develop around this workflow:

  1. We have updated a report; what are the reports that depend on this so that we can re-run them?

  2. We have a report that we want to re-run to ensure uses the latest information. Which other reports are used (directly or indirectly) by this report?

This function displays this information in an easily readable format. Allowing users to see the dependency tree and which reports are out of date and need to be re-run.

Value

An orderly tree object with the root corresponding to the given report.

Remark

By default the tree is built using data from the local report database (see orderly_commit, orderly_db). This means that it will not find changes from a report that has not be run and committed. That is, if a user changes a report to use or create different artefacts this will not be picked up by the function until the reports are re-run and committed to the archive.

It is possible to generate a tree from the source reports by using use = "src" - this generates the "theoretical tree", and has no concept of being "up to date" or of ids.

Warning

This interface is considered experimental and may change without notice. Please do not depend on it in scripts as it may break things. Consider this a (hopefully) useful way of exploring the dependencies in your reports interactively - let us know what is missing and we'll try and build it out.

Examples

path <- orderly::orderly_example("demo")

id <- orderly::orderly_run("other", root = path, parameters=list(nmin=0))
orderly::orderly_commit(id, root = path)
id <- orderly::orderly_run("use_dependency", root = path)
orderly::orderly_commit(id, root = path)
id <- orderly::orderly_run("use_dependency_2", root = path)
orderly::orderly_commit(id, root = path)
orderly::orderly_graph("other", root = path)
orderly::orderly_graph("use_dependency_2", root = path,
                                 direction = "upstream")

[Package orderly version 1.4.3 Index]