Apache Airflow Essentials
Test what you know about Apache Airflow: data intervals and the logical date, catchup and backfill, trigger rules, idempotent tasks, XComs, sensors in poke and reschedule mode, deferrable operators, pools, dynamic task mapping and asset-aware scheduling.
Question 1 of 12
Question 1
A daily Dag run covers the data interval of 2026-01-01. When does it normally start, and what is its logical date?
Not this time. A scheduled run starts after its data interval ends, so the run for 2026-01-01 starts just after 2026-01-02 00:00. Its logical date is the start of the interval, 2026-01-01, not the time it ran.
Question 2
You turn on a new Dag with a start_date 30 days ago and default settings. How many scheduled runs does Airflow create?
Not this time. Catchup is off by default (scheduler.catchup_by_default=False), so the scheduler creates a run only for the latest interval. With catchup=True it would create a run for every missed interval. For a chosen past range, run a backfill.
Question 3
A task's upstream tasks have finished, and one of them failed. Which trigger rule still runs the task?
Not this time. By default a task runs only when all its upstream tasks succeeded (all_success). all_done runs it once they have all finished, whatever their state, which suits a cleanup or a notification.
Question 4
A task loads a day of orders with INSERT. It fails half way and Airflow retries it. What is the risk, and the fix?
Not this time. Airflow can retry a task, so a task should give the same result on every run. An INSERT on a rerun can write duplicate rows. Use an UPSERT or MERGE, or overwrite the one partition the task owns.
Question 5
A task produces a 2 GB DataFrame for the next task. How should it pass it on?
Not this time. XComs are for small amounts of data, not large values like DataFrames. Write the data to storage and pass its path through XCom.
Question 6
A sensor checks every 30 minutes for a file. Why use reschedule mode instead of poke?
Not this time. In poke mode, the default, a sensor holds a worker slot for its whole runtime. In reschedule mode it takes a slot only while checking and sleeps in between. Poke suits checks every second; reschedule suits checks every minute or longer.
Question 7
What happens when an operator defers?
Not this time. A deferred operator suspends itself and frees its worker. The trigger it names runs in the triggerer, which does the waiting, and when the trigger fires the task resumes on a worker.
Question 8
Ten Dags call the same API, which allows 3 requests at once. How do you stop Airflow sending more?
Not this time. A pool with 3 slots limits how many tasks assigned to it run at once, across all Dags. Once the slots are full, the other tasks queue and start as slots free, by priority weight.
Question 9
A task should run once for each file in a list known only at run time. Which feature does that?
Not this time. Dynamic task mapping: call the task with expand() over the list, and just before it runs the scheduler creates one task instance for each input. A later task can take the collected results, as in map and reduce.
Question 10
Dag B should run whenever Dag A finishes writing a table. Which Airflow feature schedules that without a timer?
Not this time. Asset-aware scheduling: the task in Dag A lists the table as an outlet asset, and Dag B uses that asset as its schedule. Dag B runs when the task updates the asset.
Question 11
Why should a Dag file avoid calling a database at the top level, outside any task?
Not this time. Airflow parses Dag files again and again, every min_file_process_interval seconds. Top-level code runs on every parse, which slows parsing and scheduling, and calls the database each time. Do that work inside a task.
Question 12
A task fails but has retries left. Which state does it show?
Not this time. up_for_retry: the task failed but has retry attempts left and will be rescheduled. up_for_reschedule is a sensor in reschedule mode, and deferred is a task waiting on a trigger.
Sources