Skip to main content

How to Use the Graph View in Apache Airflow®

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

The Graph view draws an Apache Airflow® Dag as boxes and lines: one box per task, one line per dependency, each box coloured by how the task did in the selected run. It's the quickest way to see where a run went wrong and which tasks that held back. This guide reads a run with a failed task on Airflow 3.4.0.

The Example​

A Dag called graph_tour has four tasks: start runs first, then read_orders and read_returns side by side, and build_summary last, after both. read_returns fails on purpose, so the run has a success, a failure, and a task that never ran because of it.

Airflow's UI documentation describes the view: "Each node represents a task. Edges show the dependencies between them. You can click any task to view its metadata and recent run history."

Prerequisites​

  • Apache Airflow® running, for example with airflow standalone, and its dags folder in your AIRFLOW_HOME.

Step 1: Write the Dag​

Create dags/graph_tour.py:

dags/graph_tour.py
from airflow.sdk import dag, task


@dag(schedule=None, tags=["demo"])
def graph_tour():
@task
def start():
print("Starting")

@task
def read_orders():
print("Reading orders")

@task
def read_returns():
raise ValueError("The returns file is missing")

@task
def build_summary():
print("Building the summary")

start() >> [read_orders(), read_returns()] >> build_summary()


graph_tour()

The graph_tour.py Dag file in an editor window: four @task functions, read_returns raising ValueError("The returns file is missing"), and start() >> [read_orders(), read_returns()] >> build_summary().

The last line sets the order: start before both tasks in the list, and both before build_summary. How to Set Task Dependencies with Bitshift Operators in Apache Airflow® explains >>.

Step 2: Open the Graph View​

Trigger the Dag (How to Trigger a Dag from the Apache Airflow® UI walks through it) and open it. At the top left, click Show Graph, the icon with three joined boxes, or press g, which switches between the grid and the graph:

The graph_tour Dag in Graph view: start, success, joined to read_returns, failed, and read_orders, success, which are both joined to build_summary, upstream_failed.

The graph reads from left to right:

  • Each box is a task, with its name, its kind (@task) and its state in this run.
  • The lines are the dependencies from the code: start leads to read_returns and read_orders, and both lead to build_summary.
  • The colours follow the state: green for success, red for failed and orange for upstream_failed.

build_summary never ran. Airflow's task documentation defines the state: "upstream_failed: An upstream task failed and the Trigger Rule says we needed it". By default, a task needs all the tasks before it to succeed, and read_returns failed.

Step 3: Open a Task from the Graph​

Click read_returns. Its box gets a blue border, and the task opens in a panel next to the graph, on its Logs tab:

The panel next to the graph for read_returns: Task Instance read_returns, Failed, the Logs tab, and the end of the log, a traceback ending in raise ValueError("The returns file is missing").

The panel shows the task's state, Failed, and its log. The last lines of the traceback point to the cause: raise ValueError("The returns file is missing") in read_returns. The other tabs, such as XCom and Rendered Templates, are there too, so you can check a task without leaving the graph.

The long lines continue on the next rows because line wrapping was turned on in my browser. How to Wrap Long Lines in a Task Log in the Apache Airflow® UI shows that setting.

Step 4: Change the Graph's Direction​

Click Options, the gear icon above the graph:

The Options menu of the Graph view: Dag Version v1, Dag Run 2026-12-04 10:28:41 with a failed mark, an All Dag Dependencies switch, and Graph Direction set to Left to Right.

Graph Direction offers Left to Right, Right to Left, Bottom to Top and Top to Bottom. With Top to Bottom, the same graph reads downwards:

The same graph drawn top to bottom: start at the top, read_returns, failed and outlined in blue, and read_orders, success, below it, and build_summary, upstream_failed, at the bottom.

The tasks and lines are the same; only the layout changed. Top to bottom suits Dags with many steps in a row, which get wide from left to right.

Common Mistakes​

MistakeWhat happensDo this instead
Opening the failed task's log onlyYou see the error, but not which tasks it held backLook at the graph first: the orange upstream_failed boxes are the tasks that didn't run because of it
Assuming the upper of two side-by-side tasks runs firstThere's no line between read_returns and read_orders, so neither waits for the other, and Airflow can run them at the same timeAdd >> between them if one must wait for the other

Troubleshooting​

SymptomLikely causeFix
The boxes show no stateThe Dag hasn't run yet: a Dag without runs showed its task with only its name and @taskTrigger the Dag
A task you expected isn't in the graphThe Dag function defines the task but never calls it. A @task function only becomes a task when it's calledCall the task function in the Dag function

FAQ​

What's the difference between the Graph and the Grid?​

The Graph shows one run as boxes and lines, so it's best for seeing how tasks connect. The Grid shows the tasks as rows and recent runs as columns, so it's best for comparing runs. g switches between them.

Conclusion​

The Graph view showed graph_tour as four boxes: read_returns failed in red, and build_summary, in orange, never ran because of it. Clicking read_returns opened its log with the error, and Options changed the layout to top to bottom.

Additional Resources​

Apache®, Apache Airflow and Airflow® are either registered trademarks or trademarks of The Apache Software Foundation in the United States and/or other countries. No endorsement by The Apache Software Foundation is implied by the use of these marks.