LinuxCommandLibrary

dvc-dag

Visualize the DVC pipeline as a graph

TLDR

Visualize the entire pipeline

$ dvc dag
copy

Visualize the pipeline stages up to a specified target stage
$ dvc dag [target]
copy

Export the pipeline in the dot format
$ dvc dag --dot > [path/to/pipeline.dot]
copy

SYNOPSIS

dvc dag [OPTIONS] [TARGET]

PARAMETERS

-h, --help
    Show help message and exit.

--dry
    Don't actually build the pipeline.

-p, --pipeline <PIPELINE>
    Limit to a specific pipeline name or path.

-T, --targets-only
    Only show targets (stages and outputs).

--html
    Render graph as HTML (opens in browser).

--dot
    Render graph as DOT (prints to stdout).

--show-cache
    Show cache location nodes.

TARGET
    Limit visualization to dependencies of specific stage, data artifact, or output.

DESCRIPTION

The dvc dag command renders a Directed Acyclic Graph (DAG) of your DVC project's pipeline stages, data artifacts, and their dependencies. Ideal for data science and ML workflows, it helps visualize complex pipelines defined in dvc.yaml files, showing how stages like data processing, feature engineering, model training, and evaluation interconnect.

By default, it displays an ASCII graph in the terminal. Options allow customization, such as limiting to specific pipelines or targets, outputting interactive HTML, or DOT format for Graphviz. This aids debugging, understanding flow, and onboarding team members. Run it from a DVC-initialized Git repo with pipelines to see stage nodes (ovals), data artifacts (rectangles), and dependency arrows.

CAVEATS

Requires a DVC-initialized Git repository with pipelines; shows only DVC-tracked dependencies, ignoring external scripts or params unless declared.

EXAMPLES

dvc dag
dvc dag --html model
dvc dag --dot stage:train > pipeline.dot

HISTORY

Introduced in early DVC versions (2018) by Iterative.ai as part of pipeline visualization tools; evolved with HTML/DOT support in v1.0+ for better ML reproducibility.

SEE ALSO

dvc(1), dvc pipeline(1), dvc repro(1), dot(1)

Copied to clipboard