Skip to the workspace
Pebellslearn by building
Tracking, Orchestration and Deployment  ›  Lesson

Orchestrating Pipelines with Airflow

Airflow 15 minAn orchestrator such as Airflow runs a pipeline as a DAG of tasks with dependencies, a schedule and retries, so retraining happens automatically and in the right order.

mlops / Orchestrating Pipelines with Airflow

Explore each scene at your own pace.

01 · The rule

The rule

Orchestrating Pipelines with Airflow

Retraining the churn model each week means five steps: extract a data snapshot, validate it, train, evaluate against the champion, register the winner. A cron job running one big script can do that — until step two fails at 3 a.m. and step three happily trains on bad data. An orchestrator runs the steps as separate tasks that know about each other.

The rule

Tasks, arrows, a schedule: nothing runs before its inputs succeed.

An orchestrator runs a DAG — a directed acyclic graph. Each task is one step. Each arrow says "this task needs that one first". Acyclic means the arrows never loop back, so there is always a valid order.

Apache Airflow is the most widely used orchestrator. A DAG is a Python file:

from datetime import datetime
from airflow.sdk import dag, task

@dag(schedule="@weekly", start_date=datetime(2026, 1, 1), catchup=False)
def churn_retrain():

    @task(retries=2)
    def extract() -> str: ...          # returns the snapshot path

    @task
    def validate(path: str) -> str: ...

    @task
    def train(path: str) -> str: ...   # returns the MLflow run id

    @task
    def evaluate_and_register(run_id: str) -> None: ...

    evaluate_and_register(train(validate(extract())))

churn_retrain()

Passing one task's result into the next draws the arrows. Airflow then gives each task:

  • Its own status and logs, visible in a web UI.
  • Retries — extract retries twice, useful when a database is briefly unavailable.
  • Dependency safety — if validate fails, train and later tasks are marked upstream failed and never run.
  • Rerun from the failure — after a fix, clear the failed task and the rest continue, without repeating the successful ones.

Kubeflow Pipelines solves the same problem inside Kubernetes: each step runs as its own container, which suits teams whose training already runs on a cluster. Airflow is more general and often schedules non-ML data work too.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.