Finance reports the daily orders dashboard is missing roughly 3% of revenue versus the source system of record. Reproduce by running tests/test_late_events.py. Fix the pipeline so the test passes; keep any currently-passing tests green. Be ready to walk an interviewer through what changed and how a re-run on the next hour does or does not double-count.
dags/orders_aggregate.py
# dags/orders_aggregate.py # Hourly aggregation of orders.events into warehouse.daily_orders. # Owned by the data-platform team. Last edited: 2026-04-12. from airflow import DAG from airflow.operators.python import PythonOperator from datetime import datetime, timedelta from etl.aggregate import build_daily_orders default_args = { "owner": "data-platform", "retries": 2, "retry_delay": timedelta(minutes=5), } with DAG( dag_id="orders_aggregate", default_args=default_args, start_date=datetime(2026, 4, 1), schedule_interval="@hourly", catchup=False, max_active_runs=1, ) as dag: def _run(execution_date, **_): start = execution_date - timedelta(hours=1) end = execution_date rows = build_daily_orders(start=start, end=end) print(f"wrote {rows} rows for window {start} -> {end}") aggregate = PythonOperator( task_id="aggregate", python_callable=_run, )
Active Now|Data Engineer (L4)|||4.5k Attempts|1.8k Solves|
Airflow Debugging Exercise: The Late Arrival
An AI-assisted Airflow coding round for data engineers at mid-level level. Work in a real IDE with an AI agent, then defend your changes to an interviewer.
- Stack
- Airflow
- Format
- Debugging Exercise
- Seniority
- Mid-Level
- Estimated time
- 30 minutes
- Files in the repo
- 5
The Task
Finance reports the daily orders dashboard is missing roughly 3% of revenue versus the source system of record. Reproduce by running tests/test_late_events.py. Fix the pipeline so the test passes; keep any currently-passing tests green. Be ready to walk an interviewer through what changed and how a re-run on the next hour does or does not double-count.
Summary
The clock was lying.
Repository Files
- dags/orders_aggregate.py (python)
- etl/aggregate.py (python)
- etl/events.py (python)
- tests/test_late_events.py (python)
- requirements.txt (text)