Week 12 - Orchestration

Introduction to Orchestration

Airflow Fundamentals

Scheduling and Triggers

Sequential Pipeline Steps

Parameterized Runs and Backfills

Testing DAGs

Monitoring and Debugging

Deploying to Shared Airflow

Practice

Gotchas & Pitfalls

Assignment: Orchestration

Glossary: Week 12

Career relevance: Week 12

Going Further

History of Data Orchestration

Slides (PDF)

🎒 Assignment: Orchestration

The Scenario

Your team's morning report depends on a pipeline that someone still runs by hand. You already built ingestion and transformation logic in earlier weeks. Your next step is to operate that logic like a real data platform: automatic runs, clear dependencies, historical backfills, and failure visibility, so that nobody has to babysit it at 6 AM.

Your task is to build a production-style Airflow DAG that orchestrates a multi-step pipeline end-to-end.

Difficulty levels

Choose your level at the start.

The Required tier stays passable via local Astro execution alone if the shared class Airflow VM is offline or your cohort has not set it up.

Build one DAG that includes:

  1. A schedule. @monthly matches the Ch5 snapshot's month-partitioned pipeline and is the natural choice; use a daily schedule only if you re-partition your ingest to load one day per run (otherwise every daily run reprocesses the same month).
  2. At least three sequential tasks.
  3. Retry behavior for transient failure.
  4. {{ ds }}-parameterized execution so reruns are idempotent.
  5. A 7-day (or 7-month, depending on your cadence) historical backfill.
  6. One green run deployed to the shared class Airflow (if the shared VM is online).

Requirements

Task 1: DAG setup

Task 2: Sequential workflow with the Week 10 dbt project

Create at least three tasks in a strict dependency chain:

  1. ingest: produce or fetch the raw input your DAG will process
  2. dbt_run: run dbt with BashOperator, using the uvx --python 3.11 ... dbt run --project-dir <path> --profiles-dir <path> form from Sequential Pipelines, against your Week 10 project. Plain dbt crashes on the Astro image's Python 3.14; uvx provisions a working Python 3.11 dbt.
  3. dbt_test: run dbt test with the same uvx wrapper and flags

The dbt integration is required; it is the realistic use case for Week 12 and the mechanics were covered in Sequential Pipelines. Mount your Week 10 project under include/dbt_project/ (Astro's convention) and use --project-dir / --profiles-dir flags rather than cd.

If your Week 10 project is not runnable, the Week 12 reference repo ships a working dbt project at lassebenni/nyc-taxi-airflow-reference under include/dbt_project/. Copy that directory into your assignment project:

git clone <https://github.com/lassebenni/nyc-taxi-airflow-reference> /tmp/class-ref
cp -r /tmp/class-ref/include/dbt_project include/dbt_project

Document which project you used (your Week 10 project or the class reference) in ASSIGNMENT_REPORT.md.

Task 3: Parameterized runs

Your DAG should process one month (or day, depending on your cadence choice) of data per run, with the partition derived from Airflow's logical date rather than datetime.now(). If you followed the Parameterized Runs and Backfills snapshot, you already have this: _ds_from_context() returns the current run's date, and the ingest task slices it down to a year-month for the DELETE and the parquet URL.

Task 4: Retry and failure handling

Task 5: Backfill

  astro dev run backfill create \
    --dag-id <your_dag_id> \
    --from-date 2024-01-01 \
    --to-date 2024-07-31 \
    --max-active-runs 1

Task 6: Operational notes

Create RUNBOOK.md with:

Task 7: Deploy to the shared Airflow (Required)

Deploy your final DAG to the class's shared Airflow using the workflow you practiced in Deploying to Shared Airflow. The deploy PR goes to the shared repo, but your graded submission does not. Everything a reviewer needs, your DAG code, the screenshot, and the merged-PR link, goes into this assignment repo. Reviewers grade from your assignment repo only and never open the shared deploy repo. To log into the shared UI (to trigger the run and take the screenshot), use student-<yourname>; your password is your own Key Vault secret airflow-ui-password-<yourname>, fetched exactly as in Ch8 Step 1. If the shared class Airflow VM is offline or unavailable, you can skip this deploy step.

<aside> 💡 Local vs shared dag_id: keep dag_id="taxi_pipeline" (or whatever you used) in this assignment repo for local Astro. Only the copy you put in c55-shared-airflow must be renamed to <yourname>_taxi_pipeline. Local Graph / Grid / log screenshots may show taxi_pipeline. The shared-UI screenshot must show your namespaced DAG with all three tasks green. You do not need to redo Tasks 1–6 under the new name.

</aside>

<aside> ⚠️ Airflow 3's backfill create uses deterministic run-ids like backfill__2024-01-01T00:00:00+00:00. If a classmate already triggered a backfill for the same DAG + logical date, your second invocation is a no-op (no duplicate run is created). For the assignment, one manual trigger is enough; backfill on the shared VM is not required.

</aside>

This is what submitting real production work looks like: your code runs next to other people's code on shared infrastructure, you own your own schema, and you do not touch classmates' DAGs.

Task 8: Document your AI usage (all tiers)

Create AI_ASSIST.md recording at least one point where you used an LLM during this assignment (debugging a red task, drafting the runbook, explaining a backfill create flag). For each use, write down:

A submission with no documented AI use is incomplete on this dimension, even if the rest is strong. The point is to show critical evaluation, not to prove you avoided AI.

Deliverables

Required submissions (all of these live in this assignment PR; a green autograder alone is not a pass):

(tests/test_dag_integrity.py is required for the assignment, listed in the Definition-of-done checklist below.)

Definition of done checklist

Before submission, confirm all items. The CI autograder is a smoke test: it does not look at screenshots, row counts, or the shared deploy.

Required: