Skip to main content

prefect.utilities.visualization

Utilities for working with Flow.visualize()

Functions

get_task_viz_tracker

track_viz_task

Return a result if sync otherwise return a coroutine that returns the result

build_mermaid_dependencies

Constructs a Mermaid flowchart string representing the dependencies between tasks in the given TaskVizTracker.

build_task_dependencies

Constructs a Graphviz directed graph object that represents the dependencies between tasks in the given TaskVizTracker.
  • task_run_tracker (TaskVizTracker): An object containing tasks and their dependencies.
  • graphviz.Digraph: A directed graph object depicting the relationships and dependencies between tasks.
Raises:
  • GraphvizImportError: If there’s an ImportError related to graphviz.
  • FlowVisualizationError: If there’s any other error during the visualization process or if return values of tasks are directly accessed without specifying a viz_return_value.

visualize_task_dependencies

Renders and displays a Graphviz directed graph representing task dependencies. The graph is rendered in PNG format and saved with the name specified by flow_run_name. After rendering, the visualization is opened and displayed. Parameters:
  • graph (graphviz.Digraph): The directed graph object to visualize.
  • flow_run_name (str): The name to use when saving the rendered graph image.
Raises:
  • GraphvizExecutableNotFoundError: If Graphviz isn’t found on the system.
  • FlowVisualizationError: If there’s any other error during the visualization process or if return values of tasks are directly accessed without specifying a viz_return_value.

Classes

FlowVisualizationError

VisualizationUnsupportedError

TaskVizTrackerState

GraphvizImportError

GraphvizExecutableNotFoundError

VizTask

TaskVizTracker

Methods:

add_task

We cannot track booleans, Ellipsis, None, NotImplemented, or the integers from -5 to 256 because they are singletons.