Airflow Task Lifecycle

Every task passes through a series of states from the moment it is created until it finishes. Airflow records each state in the metadata database and shows it as a color in the UI. Reading these states tells you exactly where a task is stuck and why.

The Parcel Tracking Picture

Think of a parcel you order online. It moves through states such as "order placed", "packed", "on the truck", "delivered", or "delivery failed, retry tomorrow". A task follows the same kind of journey.

Parcel                     Task
──────────────────────────────────────
Order placed            →  none
Order confirmed         →  scheduled
Waiting at warehouse    →  queued
On the truck            →  running
Delivered               →  success
Delivery failed         →  failed
Reattempt tomorrow      →  up_for_retry

The Normal Journey

 none ──► scheduled ──► queued ──► running ──► success
                                      │
                                      ├──► failed
                                      │
                                      └──► up_for_retry ──► scheduled ...

All Task States

StateMeaning
noneTask exists but the scheduler has not looked at it
scheduledScheduler decided the task should run
queuedExecutor holds the task and waits for a free worker
runningA worker executes the task code
successTask finished without errors
failedTask raised an error and has no retries left
up_for_retryTask failed and will try again after a delay
up_for_rescheduleA sensor released its worker and will check again later
deferredTask waits for the triggerer to report an event
skippedTask was bypassed, often by a branch
upstream_failedA task before it failed, so this one cannot run
removedTask disappeared from the DAG after the run began

Stage by Stage

Scheduled and Queued

A task becomes scheduled when its parents succeed and the run is due. The scheduler then passes it to the executor, and the state changes to queued. A task stays queued when every worker slot is busy. Long queued times point to a capacity problem.

Running

A worker starts a process and runs your code. Airflow writes a heartbeat to the database every few seconds. A missing heartbeat tells Airflow that the process died.

Success and Failed

A clean finish ends in success. An uncaught error ends in failed or up_for_retry, depending on the retry settings.

Retry Cycle

from datetime import timedelta

task = PythonOperator(
    task_id="load_data",
    python_callable=load_data,
    retries=3,
    retry_delay=timedelta(minutes=5),
)

With these settings, a failed task waits five minutes and tries again, up to three times. Each attempt appears as a separate log in the UI.

States That Surprise Beginners

Skipped

Skipped does not mean broken. Branching tasks skip the paths they did not choose. The color is pink in the UI.

Upstream Failed

One failure creates a chain of upstream_failed tasks. Fix the first red task, since the orange ones only reflect that problem.

extract ──► transform ──► load
 FAILED      upstream_     upstream_
             failed        failed
   ▲
   └── fix this one first

Clearing a Task

Clearing resets a task to none so that Airflow runs it again. Use the Clear button in the Grid view after you fix the cause of a failure. Pick the option that also clears downstream tasks when later steps need fresh results.

Task State Cheat Sheet

  • Stuck in scheduled: check that the scheduler runs and the DAG is unpaused.
  • Stuck in queued: add worker capacity or raise slot limits.
  • Stuck in running: open the logs and look for a slow query or a hung request.
  • Repeated up_for_retry: read the first attempt's log for the real error.

Key Takeaways

  • A task moves through scheduled, queued, running, and a final state.
  • Colors in the UI map directly to these states.
  • Retries create extra attempts without creating extra tasks.
  • Reading the state narrows down the cause of almost any problem.