Pipeline Orchestration: Coordinating Data Workflows
Airflow, Dagster, and Prefect coordinate complex data workflows. Learn orchestration patterns, DAG design, and failure handling.
Airflow, Dagster, and Prefect handle what cron cannot: keeping track of execution order, retries, and failures across a pipeline. They turn scripts into systems you can actually monitor. Airflow has the biggest ecosystem but demands serious operational investment. Dagster takes an asset-first approach that makes data quality explicit rather than an afterthought. Prefect is Python-native and runs locally without cloud lock-in. Which one fits comes down to your existing stack and whether your team thinks in tasks or data assets.
Pipeline Orchestration: Coordinating Complex Data Workflows
A daily pipeline runs extraction from PostgreSQL, transforms in dbt, loads to Snowflake, runs BI report generation, and sends a Slack notification. Some steps must run sequentially. Others can run in parallel. If the dbt step fails, the report generation should not run, but the Slack notification should still fire with a failure alert.
This is pipeline orchestration. An orchestrator tracks dependencies, starts work on a schedule or event, and records what succeeded or failed. The database, transformation tool, and warehouse still do the actual data work.
The examples below are scoped to Airflow 3.4.0, Dagster 1.13.31, and Prefect 3.9.4, with release pages checked on November 24, 2026: Airflow release notes, Dagster releases, and Prefect releases. The snippets illustrate each framework’s model; they have not been executed here. Check the matching documentation before adapting them to another version.
What Orchestration Provides
Without orchestration, you have scripts. Scripts can be scheduled with cron, but cron does not handle dependencies, retries, or failure recovery well.
Orchestration frameworks provide:
Directed Acyclic Graphs (DAGs): Define tasks and their dependencies. The framework ensures tasks run in the correct order.
Scheduling: Trigger pipeline runs on schedules (daily at 2am), on events (new file arrives), or manually.
Retry logic: Automatic retry on failure with configurable backoff. A transient database timeout does not require manual intervention.
Logging and observability: Centralized logs for all tasks. Visibility into which tasks ran, how long they took, and what failed.
Alerting: Integration with PagerDuty, Slack, and email for failure notifications.
Resource management: Allocation of compute resources to tasks. Isolation between tasks that should not interfere.
Airflow 3.4.0: DAGs and tasks
Apache Airflow defines a workflow as a DAG of task instances. A scheduled DAG run represents a data interval; each task instance works on that run’s interval.
from datetime import datetime, timedelta
from airflow.sdk import CronDataIntervalTimetable, dag, task
@dag(
dag_id="daily_orders",
schedule=CronDataIntervalTimetable("0 2 * * *"),
start_date=datetime(2026, 1, 1),
catchup=False,
)
def daily_orders():
@task(retries=2, retry_delay=timedelta(minutes=5))
def extract_orders(data_interval_start, data_interval_end):
return extract_orders_from_postgres(
start=data_interval_start,
end=data_interval_end,
)
@task
def transform_orders(rows):
return run_dbt_transform(rows)
@task
def load_to_warehouse(rows):
return load_to_snowflake(rows)
@task
def generate_reports(_load_result):
generate_bi_reports()
extracted = extract_orders()
transformed = transform_orders(extracted)
loaded = load_to_warehouse(transformed)
generate_reports(loaded)
daily_orders()
Airflow has a large provider ecosystem, though integrations and operator APIs vary by provider version. A production deployment commonly has a scheduler, metadata database, web UI/API server, and workers. Local, Celery, and Kubernetes executors have different scaling and operations costs.
The example uses Airflow 3’s airflow.sdk TaskFlow API and an explicit CronDataIntervalTimetable so each run gets a contiguous window. In Airflow 3, a bare cron string defaults to a trigger timetable with a zero-width interval. Older Airflow examples often use PythonOperator or schedule_interval and need version-specific updates. The callable names stand in for application code, so the snippet shows orchestration structure rather than a complete runnable pipeline.
Dagster 1.13.31: Data assets
Dagster lets you define the data products first. An asset is a table, file, or model; an asset function describes how to produce it and its dependencies. Dagster still runs operations to materialize those assets, so an asset is not just another name for an Airflow task.
from dagster import asset, Definitions
@asset
def orders_raw():
"""Extract raw orders from PostgreSQL."""
return extract_orders()
@asset
def orders_cleaned(orders_raw):
"""Clean and deduplicate orders."""
return clean_orders(orders_raw)
@asset
def dim_orders(orders_cleaned):
"""Build the orders dimension table."""
return build_dim_orders(orders_cleaned)
@asset
def fact_orders(dim_orders):
"""Build the fact orders table."""
return build_fact_orders(dim_orders)
defs = Definitions(assets=[orders_raw, orders_cleaned, dim_orders, fact_orders])
In the orders example, orders_raw, orders_cleaned, and the downstream tables are assets. Asset checks, freshness policies, and partitions attach expectations and time ranges to those outputs. A schedule can request a run, while a backfill targets a range of partitions.
Dagster’s deployment needs depend on how it is hosted and which run launcher and storage it uses. Avoid treating a small local setup as a guarantee about production operations.
Prefect 3.9.4: Flows and tasks
Prefect organizes Python work as flows and tasks. A flow can call tasks directly; deployments and schedules can create flow runs. This task-and-flow model differs from Dagster’s asset graph, even when both describe the same orders pipeline.
from prefect import flow, task
@task
def extract_orders():
return query_database("SELECT * FROM orders WHERE ...")
@task
def transform_orders(orders):
return clean_and_deduplicate(orders)
@task
def load_to_warehouse(orders):
return snowflake_load(orders)
@flow
def daily_etl():
orders = extract_orders()
cleaned = transform_orders(orders)
load_to_warehouse(cleaned)
The sample shows the control flow only. In a deployed setup, the worker and orchestration API or server coordinate runs; local execution alone does not configure production scheduling or secrets.
One orders pipeline across frameworks
Use the same workload to compare the terms: extract each time window of orders from PostgreSQL, transform and validate the rows, load the warehouse tables, then refresh reports.
| Concern | Airflow 3.4.0 | Dagster 1.13.31 | Prefect 3.9.4 |
|---|---|---|---|
| Main unit | A DAG run contains task instances connected by dependencies | Assets describe data outputs; ops execute the work that materializes them | A flow run contains task runs and Python control flow |
| Schedule | A DAG timetable creates runs for data intervals; catchup controls whether missed intervals are created after deployment |
A schedule launches runs; partition definitions name the data slices, and backfills target a partition range | A deployment schedule creates flow runs; define explicitly how missed windows should be handled |
| Retry | Set retries on a task or operator; a retry repeats that task instance | Configure retry policy for the operation that materializes an asset | Set retry options on a task |
| Backfill | Run the DAG for a chosen interval range; tasks must tolerate reruns | Materialize selected asset partitions | Create flow runs for the intended time windows; the application must pass those windows into tasks |
For all three, pass the intended interval into the extract query, such as created_at >= start AND created_at < end. Do not derive the batch window from the wall clock inside a retry: a retry should process the same interval as the original attempt. Airflow calls these values the data interval. Dagster commonly represents the window with a partition key. Prefect schedules create runs, but the flow still needs a clear rule for which window each run processes.
In Airflow, catchup=False skips missed scheduled intervals when a DAG is activated or resumed; catchup=True creates runs for the missed intervals from the start date. A manual backfill can target a chosen historical range. In Dagster, backfill selected partitions. For Prefect, decide how missed scheduled runs should be handled and pass an explicit window into each flow; do not assume its schedule behaves like Airflow’s catchup setting.
Trigger Rules and Conditional Logic
Pipeline tasks need more than simple sequential execution. They need conditional logic.
Trigger rules determine when a task should run based on upstream outcomes:
all_success(default): All upstream tasks succeededall_failed: All upstream tasks failednone_failed: No upstream task failed (succeeded or skipped)none_skipped: No upstream task was skippedall_done: Run after every upstream task reaches a terminal state, including failure
from airflow.sdk import dag, task
@dag(schedule=None)
def trigger_rules_example():
@task
def load_to_warehouse():
return load_data()
@task
def generate_reports(_load_result):
return refresh_reports()
@task(trigger_rule="all_done")
def notify():
send_notification()
loaded = load_to_warehouse()
report = generate_reports(loaded)
[loaded, report] >> notify()
trigger_rules_example()
none_failed is not a failure notification rule: an upstream failure prevents it from running. Use all_done when a notification must inspect either outcome.
Failure Handling and Retries
Retries help with transient failures such as a short database outage. They also repeat work, so make each step safe to run more than once. For a warehouse load, write to a staging table keyed by the data interval, validate it, and use a transaction or idempotent MERGE to publish it. A rerun should replace or upsert the same interval, not append duplicate rows.
from datetime import timedelta
from airflow.sdk import task
@task(
retries=3,
retry_delay=timedelta(minutes=5),
retry_exponential_backoff=True,
max_retry_delay=timedelta(hours=1),
)
def load_interval():
return load_idempotent_interval()
For non-transient failures, preserve the last known-good output. Use staging tables and a transaction or atomic publish step so a failed load does not leave a half-refreshed table. Avoid automatic retries for invalid credentials, malformed data, or other failures that need a fix first.
-- Pseudocode; adapt transaction and conditional syntax to your warehouse.
BEGIN TRANSACTION;
-- Replace only this interval so the same run can be retried safely.
DELETE FROM fact_orders
WHERE order_date >= :interval_start AND order_date < :interval_end;
INSERT INTO fact_orders
SELECT * FROM fact_orders_staging
WHERE order_date >= :interval_start AND order_date < :interval_end;
validation_ok = validate_interval(:interval_start, :interval_end);
IF validation_ok THEN
COMMIT;
ELSE
ROLLBACK;
END IF;
-- Roll back on statement errors as well; do not commit a partial interval.
Retries can amplify an outage. If many tasks retry the same unavailable database at once, they create more load just when it is least able to respond. Use bounded retries with backoff, cap concurrent work, and avoid retrying permanent errors. Keep database and warehouse credentials in the orchestrator’s supported secrets integration or a runtime secret store. Grant each task only the access it needs; do not put secrets in DAG files, source control, task arguments, or logs.
Recovery exercise: one failed orders interval
Assume the load for the UTC interval [2026-11-23 00:00, 2026-11-24 00:00) wrote staging rows, then the validation step failed.
- Find the failed run and record its interval, failed task, retry history, and task logs.
- Check the staging table’s interval key and row count. Confirm that publishing has not changed the last known-good warehouse table.
- Correct the validation issue, then rerun that same interval. Do not widen the date range or launch every historical interval.
- Confirm the rerun replaces or upserts the interval without duplicate orders. Compare row counts and run the relevant data quality checks.
- Verify that reports refreshed only after a successful publish and that the alert records the failed attempt and recovery.
The exercise is complete when the interval is correct, rerunning it is safe, and the next scheduled interval can still proceed normally.
Observability: Beyond Logging
Pipeline observability means knowing the state of your pipelines without digging through logs.
Pipeline-level metrics: Duration, success/failure rate, SLAs met. These aggregate up to give a dashboard view of overall pipeline health.
Task-level metrics: Per-task duration, retry count, resource usage. These help identify bottlenecks and failures.
Data freshness: When was each table last updated? How stale is the data?
# Example: Prometheus metrics from Airflow
metrics:
- name: pipeline_duration_seconds
type: gauge
labels: [pipeline_name, status]
- name: pipeline_tasks_total
type: counter
labels: [pipeline_name, task_name, status]
- name: data_freshness_minutes
type: gauge
labels: [table_name]
For more on monitoring, see Metrics, Monitoring, and Alerting.
When to Use Pipeline Orchestration
Use orchestration when:
- You have multiple pipeline steps with complex dependencies that are hard to manage in scripts
- Pipelines need retry logic, failure handling, and alerting beyond what cron provides
- Multiple teams need to understand pipeline state without digging through logs
- You need visibility into pipeline SLAs, freshness, and historical performance
Do not use orchestration when:
- Pipelines are simple and linear with no branching dependencies
- One-off data movements that will never run again
- The overhead of maintaining orchestration infrastructure outweighs the benefits for trivial pipelines
DAG Structure Example
A DAG defines task dependencies. Here is a typical ETL DAG with branching logic:
flowchart TD
Start[Daily Trigger] --> Extract[Extract from PostgreSQL]
Extract -->|raw data| Load[Load to Snowflake]
Load -->|staged data| Transform1[dbt: stg_orders]
Load -->|staged data| Transform2[dbt: stg_customers]
Transform1 -->|cleaned| Transform3[dbt: dim_orders]
Transform2 -->|cleaned| Transform3
Transform3 -->|mart| Report[Generate BI Reports]
Report --> Notify[Send Slack Notification]
Extract -->|on failure| Alert[PagerDuty Alert]
Transform3 -->|on failure| Alert
The DAG structure makes dependencies explicit. You can see at a glance that dim_orders depends on both stg_orders and stg_customers, which depend on the initial load.
Trade-off Table: Airflow vs Dagster vs Prefect
| Aspect | Airflow | Dagster | Prefect |
|---|---|---|---|
| Mental model | Tasks in a DAG | Data assets | Tasks and flows |
| Scheduling | Built-in scheduler | Built-in scheduler | Built-in scheduler |
| UI quality | Functional, dated | Modern, asset-centric | Modern |
| Operational complexity | High (DB, workers, scheduler) | Medium | Low (local) to Medium (cloud) |
| dbt integration | Via operator | Native (asset) | Via task |
| Failure handling | Task retries | Retry policies on asset materialization | Task retries |
| Deployment | Standalone | Standalone or cloud | Standalone or cloud |
| Learning curve | Steep | Moderate | Easy |
| Best for | Large ecosystems, existing Airflow teams | Asset-centric pipelines, data quality focus | Python-first teams, developer experience |
Airflow wins for large existing deployments with extensive ecosystem integrations. Dagster wins for teams prioritizing data assets and quality. Prefect wins for Python-first teams who want to start local and scale to cloud.
Orchestration Anti-Patterns
Pipeline orchestration goes wrong in predictable ways:
Blocking sensors: A sensor task that polls for a file or condition every minute for hours holds a worker slot. Use async sensors or external triggering instead.
Excessive cross-DAG dependencies: DAG A waits for DAG B to complete. DAG B waits for DAG C. One failure cascades. Keep cross-DAG dependencies to a minimum and use callback-based triggering where possible.
Hard-coded resource assumptions: A task assumes 4GB of memory is always available. On a saturated worker, it fails repeatedly. Use resource declarations and let the orchestrator handle scheduling.
No pipeline SLAs: A pipeline is marked “done” when it finishes, not when its outputs are fit for use. Define SLAs for data freshness, not just task completion.
Over-granular tasks: Breaking a pipeline into tasks for every single SQL query creates overhead and makes the DAG unreadable. Group related operations into cohesive tasks.
Quick Recap
- Orchestration frameworks manage dependencies, scheduling, retries, and monitoring for complex pipelines.
- Airflow is the ecosystem standard with the steepest operational curve.
- Dagster takes an asset-centric approach that makes data quality explicit.
- Prefect prioritizes developer experience and local-to-cloud flexibility.
- Use
all_donefor an Airflow alert task that must run after either outcome;none_faileddoes not run after an upstream failure. - Treat pipelines as production systems: SLAs, alerting, and failure recovery are not optional.
Conclusion
Pipeline orchestration turns scripts into reliable, observable workflows. Airflow, Dagster, and Prefect each take different approaches, but all solve the same core problems: dependency management, scheduling, retry logic, and observability.
The choice between them depends on your team’s existing skills, operational capacity, and whether you prefer an asset-centric or task-centric mental model. For teams already using dbt, Dagster’s asset model is a natural fit. For teams with existing Airflow investments, the ecosystem argument is strong.
Whatever framework you choose, treat orchestration as the foundation of your data platform. A well-orchestrated pipeline fails gracefully, retries appropriately, and tells you when something is wrong before your users do.
For related reading on pipeline patterns, see Extract-Transform-Load and Data Quality.
Category
Related Posts
Master git add: Selective Staging, Patch Mode, and Staging Strategies
Master git add including selective staging, interactive mode, patch mode, and staging strategies for clean atomic commits in version control.
Git Branch Basics: Creating, Switching, Listing, and Deleting Branches
Master the fundamentals of Git branching — creating, switching, listing, and deleting branches. Learn the core commands that enable parallel development workflows.
Git Cherry-Pick: Selectively Applying Commits
Master git cherry-pick to selectively apply commits between branches. Learn use cases, pitfalls, and best practices for targeted commit transplantation.