Orchestration at Scale — Data Engineering

Orchestration at scale connects many teams' pipelines through assets: raw_order_lines, sales, weekly_best_sellers, and the marketing team's customer_segments…

On the night from Sunday to Monday, Bookshop's MySQL extract runs late, until 01:30. sales still runs at 01:00 as cron says, weekly_best_sellers at 02:00, and at 06:00 the owner reads a report that arrived on time but is one book short, with no error and no alarm. The single Airflow DAG from the earlier lesson is only the start. Orchestration at scale is running many pipelines owned by many teams that depend on one another, in the right order, on the right data, and knowing when something is stuck. It's like an airport. Many airlines, many planes, one control tower. The connecting flight waits for transit passengers whose first flight landed late; it does not leave just because the clock says so, abandoning half its passengers. When a plane is held too long, the airport board shows DELAYED so everyone knows. The control tower is the orchestrator, departure times are cron, "leave after the transit flight lands" is data-aware scheduling, and the DELAYED board is an alert.

From one DAG to many teams

In the Airflow lesson, one DAG did everything. As teams grow, pipelines split up, and what connects them are assets: tables or files one pipeline produces and another reads. Bookshop's small asset graph in the Lab:

Asset Owner Read by
raw_order_lines data team, MySQL extract at 00:05 sales
sales data team, one partition per day weekly_best_sellers, customer_segments
weekly_best_sellers data team the shop owner, Monday 06:00
customer_segments marketing team email campaigns

customer_segments belongs to another team, in another repo, with its own schedule. The question: when may it run?

Cron or data-aware

There are two ways to trigger sales:

On the night of Sunday 4 to Monday 5 October, the MySQL replica lags and raw_order_lines only finishes at 01:30. The 4 October partition holds Maya's order 8 (1 The Rainbow Troops). The Lab's result, run in SQLite:

Scheduling sales[2026-10-04] weekly_best_sellers ready Week of 28 September
cron 01:00 runs 01:00, 0 rows 02:00 12 books, the "Unknown" row is missing
data-aware runs 01:31, 1 row 01:33 13 books, complete

With cron, the report is short and arrives on time, with no error and no alarm, just as at the start of this lesson. Data-aware is a little later but right, and the marketing team waits for complete data too.

In Airflow 3, asset-based scheduling is written with Asset. This code is parsed by Airflow 3.3.2 with no import errors:

import pendulum
from airflow.sdk import Asset, dag, task

LONDON = "Europe/London"
raw_order_lines = Asset("raw_order_lines")
sales = Asset("sales")


@dag(schedule="5 0 * * *", start_date=pendulum.datetime(2026, 9, 28, tz=LONDON), catchup=False)
def extract_mysql():
    @task(outlets=[raw_order_lines])
    def load_raw() -> None:
        ...  # copy yesterday's orders from the MySQL replica

    load_raw()


@dag(schedule=[raw_order_lines], start_date=pendulum.datetime(2026, 9, 28, tz=LONDON), catchup=False)
def build_sales():
    @task(outlets=[sales])
    def load_sales() -> None:
        ...  # DELETE then INSERT one date

    load_sales()


extract_mysql()
build_sales()

In Dagster (1.13.26), assets are the centre: each @dg.asset function produces one table, and automation_condition says when it is rebuilt. Part of the code that ran on a laptop with DuckDB:

daily = dg.DailyPartitionsDefinition(start_date="2026-09-28", timezone="Europe/London")


@dg.asset(partitions_def=daily)
def sales(context: dg.AssetExecutionContext) -> dg.MaterializeResult:
    order_date = context.partition_key  # e.g. "2026-10-04"
    ...  # DELETE then INSERT one date
    return dg.MaterializeResult(metadata={"row_count": row_count})


@dg.asset(
    deps=[sales],
    automation_condition=dg.AutomationCondition.eager(),
    freshness_policy=dg.FreshnessPolicy.time_window(fail_window=timedelta(hours=30)),
    owners=["team:data"],
)
def weekly_best_sellers() -> dg.MaterializeResult: ...

AutomationCondition.eager() means "rebuild as soon as upstream changes". In Prefect (3.8.8), the pipeline is plain Python functions with @flow and @task(retries=2, retry_delay_seconds=300); a deployment is scheduled by cron or triggered by events through an automation.

Sensors or events

Sometimes what you wait for is not an asset in the same orchestrator, such as the marketplace's stock file in an SFTP folder.

Use an event when the source can announce itself, a sensor when it cannot.

SLA, freshness and alerts

The owner reads weekly_best_sellers on Monday at 06:00. The promise "the report is ready before 06:00" is an SLA (service level agreement), and freshness is how recent the data is. Two alarms are needed:

In Airflow 3 the old SLA feature was removed and replaced by Deadline Alerts. Dagster has the FreshnessPolicy in the code above (fail when not updated for more than 30 hours). dbt has source freshness from the dbt lesson. Careful: a freshness check does not know whether the content is right. With cron on that late night, the check says OK, because the report was indeed updated at 02:00. Data quality tests (the data quality lesson) catch the content.

Big backfills and idempotency

A backfill reruns an asset for past dates, for example after a transform rule is fixed. A backfill of sales from 28 September to 4 October with Dagster 1.13.26, one partition per run, then weekly_best_sellers:

for order_date in ["2026-09-28", "2026-09-29", "2026-09-30", "2026-10-01", "2026-10-02", "2026-10-03", "2026-10-04"]:
    result = dg.materialize([sales], partition_key=order_date)
    meta = result.asset_materializations_for_node("sales")[0].metadata
    print(order_date, result.success, meta["row_count"].value)

result = dg.materialize([weekly_best_sellers])  # its metadata: books in the week of 28 September
print("weekly_best_sellers", result.success, result.asset_materializations_for_node("weekly_best_sellers")[0].metadata["books_week_28_sep"].value)
2026-09-28 True 3
2026-09-29 True 1
2026-09-30 True 2
2026-10-01 True 2
2026-10-02 True 1
2026-10-03 True 0
2026-10-04 True 1
weekly_best_sellers True 13

A backfill is safe only when each partition is idempotent, as in the ETL lesson: DELETE that date first, then INSERT. With INSERT alone, every partition that was already filled doubles, and that week becomes 26 books. At scale, time counts too. A year = 365 partitions; at 2 minutes each with at most 4 at once: 92 waves, 184 minutes. The parallel limit is on purpose, so the MySQL replica is not flooded with 365 queries at once.

Cost

The orchestrator itself runs 24 hours: scheduler, workers, metadata database, and for Airflow also the triggerer and API server. A poke sensor that waits long eats a worker slot. A backfill pays warehouse compute for every partition. Managed services move the servers to a vendor, for a monthly price: Astronomer, Google Cloud Composer and Amazon MWAA for Airflow; Dagster+ for Dagster; Prefect Cloud for Prefect. For Bookshop, cron plus the one DAG from the Airflow lesson is still enough; orchestration at scale starts to matter when several teams have dozens of pipelines that depend on each other.

Airflow, Dagster, Prefect

All three are open source (Apache 2.0) and written in Python. Versions as of October 2026: Airflow 3.3.2 (17 September 2026), Dagster 1.13.26 (9 October 2026), Prefect 3.8.8 (6 October 2026).

Airflow Dagster Prefect
Main unit DAGs and tasks assets (tables or files) flows and tasks (Python functions)
Data-aware assets since 3.0 (datasets since 2.4) the core of its design, with partitions and backfills event triggers through automations
Try it on a laptop airflow dags test dg.materialize(...) call the flow function directly
Typical strength the largest ecosystem of operators and providers asset lineage, dbt integration dynamic Python pipelines

Prefect and Dagster were born after Airflow, with a native Python API, data-aware scheduling and a developer experience designed in from the start; that is the difference most often cited. Airflow caught up: the TaskFlow API in 2.0, datasets in 2.4, assets and the airflow.sdk imports in 3.0. A team that already has hundreds of Airflow DAGs usually gains most by staying; a team that thinks in dbt tables often fits Dagster; a team with many Python scripts that needs retries and triggers quickly often fits Prefect. Choose from your team's needs, not from which sounds newest.

⚠️ Cron, backfills, alarms and sensors used the wrong way

TL;DR: Orchestration at scale connects many teams' pipelines through assets: raw_order_lines, sales, weekly_best_sellers, and the marketing team's customer_segments. Cron runs at a fixed time; data-aware runs when the upstream updates. When the extract runs late until 01:30, cron makes the report on time but short (12 books), data-aware makes it at 01:33 and complete (13). Airflow 3 writes it as outlets=[Asset(...)] and schedule=[Asset(...)], Dagster with @dg.asset and AutomationCondition.eager(), Prefect with deployments and automations. A sensor checks periodically (37 checks to wait 3 hours), an event triggers once. Set a failure alarm and a freshness check (Deadline Alerts in Airflow 3, FreshnessPolicy in Dagster), and remember a freshness check does not judge content. A backfill is safe only with idempotent partitions (INSERT alone: 26 books, not 13), and is limited in parallelism. Airflow 3.3.2, Dagster 1.13.26 and Prefect 3.8.8 are chosen by a team's needs, not ranked.

⚡ Cron or data-aware

Guess first: the MySQL extract runs late, until 01:30, but sales runs on a 01:00 cron. How many books does the report show for the week of 28 September?

It shows 12, where the truth is 13. The "Unknown" row is missing, with no error and no alarm. Data-aware, sales only runs at 01:31 and the result is complete.

Meaning: Cron runs at a fixed time, whether its upstream is ready or not. Data-aware runs as soon as its upstream is updated.

⚡ Assets in Airflow 3

Write:

@dag(schedule=[raw_order_lines], start_date=pendulum.datetime(2026, 9, 28, tz=LONDON), catchup=False)
def build_sales():
    @task(outlets=[sales])
    def load_sales() -> None:
        ...  # DELETE then INSERT one date

Meaning: schedule=[raw_order_lines] makes the DAG run on every event for that asset. outlets=[sales] records a new event when the task succeeds, so the marketing team just writes schedule=[sales].

⚡ A freshness alarm

Meaning: At 06:00, check whether weekly_best_sellers was updated tonight. If not, the owner knows the report isn't there, instead of reading wrong numbers. But freshness doesn't know whether the content is right: that's what data quality tests are for.

⚡ A safe backfill

Meaning: A backfill is safe only when each partition is idempotent: DELETE that date first, then INSERT. The parallel limit is there on purpose too, so the MySQL replica isn't flooded with 365 queries at once.

What you will learn