Skip to content

Adding Flow Visualization for Prefect

Gaurang Katre edited this page Jan 22, 2022 · 1 revision

Now you have created a Prefect (perhaps perfect) Flow but sometimes wonder how the tasks interact with one another...now there is a way to visually see a schematic of how the task-graph looks like

Steps:

  1. add the graphviz as a dev-package in the PR Pipfile. Note: this may have already been done in the Pipfile gitrepo and you may only need to update your pipenv local development environment with pipenv update
  2. the graphviz executable will also be needed to see the Flow Visualizations. Find the install instructions for your local workstation here: (install graphviz)
  3. to see the cool visualizations for your Flow, use flow.visualize() as shown in this example:
from prefect import Flow, Parameter

with Flow("math") as f:
    x, y = Parameter("x"), Parameter("y")
    a = x + y

f.visualize()

A visualization example with graphviz: Flow visualization with task dependencies