WorkflowDagCheck (workflow_dag_check v1.0.0)

Copy Markdown View Source

Check a list of workflow steps and their dependencies.

Input is a CSV with the columns step (an id, trimmed) and depends_on (zero or more step ids separated by a semicolon, empty for none). Extra columns are ignored.

An arrow in a report reads "depends on": A -> B means step A depends on step B.

Checks: duplicate step ids, a dependency naming a step that does not exist, a step depending on itself, and a cycle (one cycle path is reported). After removing unknown and self dependencies the tool lists start steps (no dependencies), end steps (nothing depends on them), a run order (Kahn's algorithm, ties broken by step id) and the levels. When a step id appears on more than one row, the rows are merged and their dependencies are combined. Steps are always visited in sorted id order, so the output is deterministic.

Summary

Functions

Analyse the rows. Returns a map with :steps, :problems (a list of strings), :start, :end, :order and :levels (order and levels are nil when a cycle exists).

Parse the CSV text into a list of rows.

True when the analysis found any problem.

Printable report: problems first, then start and end steps, run order and levels.

Types

row()

@type row() :: %{step: String.t(), deps: [String.t()]}

Functions

analyze(rows)

@spec analyze([row()]) :: map()

Analyse the rows. Returns a map with :steps, :problems (a list of strings), :start, :end, :order and :levels (order and levels are nil when a cycle exists).

parse(text)

@spec parse(String.t()) :: {:ok, [row()]} | {:error, String.t()}

Parse the CSV text into a list of rows.

problems?(analysis)

@spec problems?(map()) :: boolean()

True when the analysis found any problem.

render(a)

@spec render(map()) :: String.t()

Printable report: problems first, then start and end steps, run order and levels.