Apache Airflow DAG interview questions: schedules, dependencies, and catchup

Reviewed by Mark Dickie · Last updated

4 questions on this page you can answer and see marked on the spot. Go to the first one

Apache Airflow DAGs are Python files that define a graph of tasks, the order they run in, and the schedule that starts them. Most interview questions test whether you can read a DAG definition and predict what the scheduler does with it: when the first run fires, which tasks wait on which, and what happens to intervals it missed. The questions usually turn on four parameters, schedule, start_date, catchup, and the >> and << dependency operators, because those decide run timing and task order. Airflow 3 uses logical_date where Airflow 2 code says execution_date, so know both names.

ConceptWhat to knowCommon trap
scheduleA cron string, a preset such as @daily, a timedelta, or None for runs you trigger by handschedule=None turns off automatic runs, so nothing fires on its own
start_dateThe first logical date the scheduler considersA run for an interval starts only after that interval ends, so a daily DAG with a recent start_date runs one period later than people expect
catchupWhether intervals between start_date and now are backfilledIt defaults to the catchup_by_default config value, which is True in a stock install, so a new DAG can launch dozens of runs at once
Dependenciestask_a >> task_b or task_b << task_a, or set_downstreamA cycle is rejected when the DAG file is parsed, not when it runs
Top-level codeAnything outside a task function runs each time the scheduler parses the fileA database call at module level hits your database on every parse
default_argsA dict applied to every operator in the DAGretries set here applies to all tasks, including ones that should fail fast

Which Apache Airflow DAG concepts does an interview test?

Interviewers tend to give you a short DAG file and ask what runs, in what order, and when. Be ready to explain these:

  1. Why the first run for a daily DAG covers the interval that starts at its start_date, and why it doesn't fire until that interval has ended.
  2. What catchup=False changes, and what happens to the scheduler when catchup is left on with an old start_date.
  3. The task order produced by a chain such as extract >> [transform_a, transform_b] >> load.
  4. How the same pipeline looks with the with DAG(...) as dag: context manager and with the @dag and @task decorators.

How do you practice Apache Airflow DAG questions?

Write the DAG yourself before reading the answer. Set catchup=False, run airflow dags trigger <dag_id>, and compare the runs you see in the UI with the ones you predicted.

Key facts

  • Tarmac's Apache Airflow interview questions cover 10 questions at difficulty 1–5 of 5.
  • Tarmac tracked 247 job postings asking for Apache Airflow in November 2026.
  • Roles asking for Apache Airflow advertise a median base salary of £81,750, across 78 job postings as of November 2026.
  • Tarmac last reviewed these Apache Airflow interview questions on 3 December 2026.

At a glance

Questions10
Difficulty1–5 of 5
FormatsOrdering, Coding exercise, Code output, True / false, Find the bug, Short answer, Multiple choice, Flashcard, Fill in the blank
Interactive1 run your code against tests, in the app

What you'll review

  1. dag

Practice questions

Try one before you open the answer. Pick an option and press Check; it's marked on the spot.

When the Apache Airflow scheduler processes a DAG, arrange the following logical data-flow stages in the order they occur — from reading the DAG file to executing tasks on workers.#

Put these in order

Show answer

The Airflow scheduler's logical data-flow pipeline proceeds as follows: first the DAG Python file is parsed to load the DAG definition into memory, then the DAG is serialized and its metadata is registered in the Airflow metadata database, then the schedule interval is evaluated to determine whether a new DAG Run should be created, then upstream task dependencies are checked and ready Task Instances are scheduled, and finally those Task Instances are queued with the executor and run on workers.

Why:

The DagFileProcessorProcess first parses the DAG Python file to load the DAG object into memory. It then serializes the DAG and writes/updates its metadata in the Airflow metadata database. The scheduler's main loop later reads the serialized DAG metadata and evaluates the schedule interval to decide whether a new DAG Run should be created. Once a DAG Run exists, the scheduler checks each task's upstream dependencies and marks ready Task Instances as scheduled. Finally, the executor queues those Task Instances and dispatches them to workers for execution. These stages represent the logical progression of DAG state from file to execution; in Airflow's multi-process architecture the DagFileProcessorProcess handles parsing and serialization while the scheduler's main loop handles scheduling decisions, so they need not run in strict lockstep, but the data each later stage consumes is produced by an earlier one.

In Apache Airflow, a DAG's root tasks are the tasks with no upstream dependencies. The scheduler can start them first.#

Starter code

def find_root_tasks(tasks, edges):
    # TODO: return sorted task_ids with no upstream dependency
    return []

Your solution must pass

  • linear chain
  • two roots fan-in

This one is written and run, not read. Solve it in the app and your code is executed against these tests and the hidden ones.

Given the following Airflow 2.x DAG definition, what is printed to stdout when this script runs as a plain Python script (e.g., python dag_file.py)?#

from airflow.models.dag import DAG
from airflow.operators.dummy import DummyOperator
from datetime import datetime

with DAG(
    dag_id='etl_pipeline',
    start_date=datetime(2023, 1, 1),
    schedule_interval='@daily',
) as dag:
    extract = DummyOperator(task_id='extract')
    validate = DummyOperator(task_id='validate')
    enrich = DummyOperator(task_id='enrich')
    aggregate = DummyOperator(task_id='aggregate')
    publish = DummyOperator(task_id='publish')

    extract >> validate >> enrich
    extract >> aggregate
    enrich >> publish
    aggregate >> publish

print(sorted(extract.downstream_task_ids))
print(sorted(publish.upstream_task_ids))
print(sorted(aggregate.upstream_task_ids))
print(validate.downstream_task_ids)
Show answer
['aggregate', 'validate']
['aggregate', 'enrich']
['extract']
{'enrich'}
Why:

The >> operator registers the right-hand task as a downstream dependency of the left-hand task. extract >> validate >> enrich creates two edges: extract → validate and validate → enrich. extract >> aggregate adds extract → aggregate. enrich >> publish and aggregate >> publish both point into publish. Now trace each print: (1) extract.downstream_task_ids is the set {validate, aggregate}; sorted() yields ['aggregate', 'validate']. (2) publish.upstream_task_ids is {enrich, aggregate}; sorted yields ['aggregate', 'enrich']. (3) aggregate.upstream_task_ids is {extract}; sorted yields ['extract']. (4) validate.downstream_task_ids is the set {enrich} — printed directly without sorted(), so Python displays it as {'enrich'}.

In Apache Airflow 2.x, top-level Python code in a DAG file (code outside of any task callable or operator execute method) runs every time the DAG processor parses the file, not just when a DAG run executes.#

Options

Show answer

Yes. In Airflow 2.x, top-level code in a DAG file runs every time the DAG processor parses the file, which happens on a repeating interval set by min_file_process_interval. Parsing means importing the module, and importing runs all module-level code. Heavy work like database or API calls should go inside tasks so it doesn't slow down scheduling.

Why:

The DAG processor re-imports each DAG file on a regular interval (controlled by min_file_process_interval) to find DAG objects. Importing a file runs all of its top-level code. That means expensive work at module level, such as database queries, API calls or reading Variables, runs on every parse, not only when tasks execute. This slows scheduling and puts load on external systems. For that reason, Airflow's best-practice guidance says to move this kind of logic into task callables or templated fields.

The following Apache Airflow 2.x DAG definition (Airflow 2.x, e.g. 2.9) is loaded into the Airflow scheduler, but the scheduler refuses to load it and reports that the DAG is invalid. Identify the single line that causes the error.#

from airflow import DAG
from airflow.operators.python import PythonOperator
from datetime import datetime

def extract():
    pass

def transform():
    pass

def load():
    pass

with DAG(
    dag_id="etl_pipeline",
    start_date=datetime(2024, 1, 1),
    schedule_interval="@daily",
    catchup=False,
) as dag:
    extract_task = PythonOperator(task_id="extract", python_callable=extract)
    transform_task = PythonOperator(task_id="transform", python_callable=transform)
    load_task = PythonOperator(task_id="load", python_callable=load)

    extract_task >> transform_task
    transform_task >> load_task
    load_task >> extract_task
Show answer

The bug is on line 26.

Why:

This question targets Apache Airflow 2.x (for example 2.9), where schedule_interval is still a valid DAG argument and airflow.operators.python.PythonOperator is the correct import, so the only load-time error is structural. Lines 24 and 25 create the chain extract → transform → load, which is acyclic. Line 26 (load_task >> extract_task) adds an edge from the load task back to the extract task, closing a cycle. Airflow checks for cycles when it parses the DAG and rejects it, so the scheduler reports the DAG as invalid. Removing line 26 leaves an acyclic graph that loads correctly.

In Airflow 2.x, a teammate's DAG file contains top-level code (outside any task) that calls an external REST API and queries a database to build the list of tasks dynamically. The scheduler is becoming slow and the API is getting hammered. Explain why this happens and how you would restructure the DAG to fix it.#

Show answer

The DAG file processor re-parses (re-imports) every DAG file in the dags folder on a regular interval (min_file_process_interval, default 30s), and workers parse the file again when they run each task. Every parse runs the top-level code, so the API call and DB query run over and over. That slows parsing, can hit dagbag_import_timeout, and puts load on the external systems. The fix is to keep top-level code light and deterministic. Move the API and DB calls inside tasks, which run only at execution time. If the task list really has to be dynamic, use dynamic task mapping (.expand()) on the output of an upstream task. You can also read from a cached or static config file, or an Airflow Variable through Jinja templating instead of Variable.get at top level.

Why:

Airflow treats DAG files as configuration that gets parsed again and again. It does not run them once. The scheduler's DAG processor imports each file every few seconds, and each task run parses the file again, so expensive top-level code runs constantly. The usual fix is to defer that work to task execution time. Dynamic task mapping (expand) handles the dynamic part, building tasks at runtime from upstream results instead of at parse time.

Consider the following Airflow DAG (Airflow 2.x, timezone-aware UTC):#

Options

Show answer

Two runs are queued, with logical dates 2024-01-01 and 2024-01-02. Airflow only schedules a DAG run after its data interval has ended. With @daily and start_date=2024-01-01, the interval starting at 2024-01-03 00:00 does not close until 2024-01-04 00:00, so at 14:00 on January 3 no run is created for it yet. catchup=True backfills the two already-completed intervals.

Why:

In Airflow, a DAG run is scheduled only after its data interval has ended. With @daily and start_date=2024-01-01, the intervals are:

• [2024-01-01 00:00, 2024-01-02 00:00) — logical_date 2024-01-01, ended at 2024-01-02 00:00 ✓ • [2024-01-02 00:00, 2024-01-03 00:00) — logical_date 2024-01-02, ended at 2024-01-03 00:00 ✓ • [2024-01-03 00:00, 2024-01-04 00:00) — logical_date 2024-01-03, ends at 2024-01-04 00:00 ✗ (not yet ended at 14:00 on Jan 3)

catchup=True means the scheduler backfills all completed intervals since start_date, so it queues runs for logical dates 2024-01-01 and 2024-01-02. The 2024-01-03 interval has not yet closed, so no run is created for it yet — that run will be scheduled at 2024-01-04 00:00. This is why logical_date (formerly execution_date) represents the start of the data interval, not the moment the run is triggered. The claim that catchup backfills every interval from start_date through today is the most common misconception; Airflow does not schedule a run for an interval that is still in progress.

In Airflow 2.x, what does the DAG-level max_active_runs parameter limit, how does it differ from max_active_tasks, and what limits how many runs execute at once when catchup=True produces a large backfill?#

Show answer

max_active_runs caps how many DagRuns of the DAG can be in the running state at the same time. max_active_tasks (named concurrency before 2.2) caps how many task instances of the DAG can run at once, counted across all of its active runs. When catchup covers many intervals, no more than max_active_runs of those runs execute concurrently; the remaining intervals wait until a running run finishes and frees a slot. Task execution inside each running run is further limited by max_active_tasks, pools, and global parallelism.

Why:

The two limits act at different levels. max_active_runs counts whole DagRuns in the running state, so it controls how many intervals of the DAG are in flight at once. max_active_tasks counts task instances across all of the DAG's active runs, so it controls parallelism within those runs. A large catchup is therefore throttled by max_active_runs: only that many runs proceed at a time, and the others wait until a slot opens. This answer deliberately avoids claiming how the scheduler materializes the waiting runs internally, since that has changed across 2.x releases, and it avoids claiming a strict chronological processing order, which depends on other settings such as depends_on_past and scheduler ordering.

In Airflow 2.x, consider a DAG defined as follows:#

Options

Show answer

The scheduler creates a DAG run with logical_date = 2024-03-14 00:00:00 UTC. In Airflow 2.x, logical_date equals data_interval_start, and the scheduler only creates a scheduled run after that run's data_interval_end has passed. With catchup=False, the scheduler skips all historical intervals since start_date and creates a run only for the most recently completed data interval — [2024-03-14 00:00, 2024-03-15 00:00) — because the interval containing the current time has not closed yet.

Why:

In Airflow 2.x, a DAG run's logical_date equals its data_interval_start, and the scheduler only creates a scheduled DAG run after that run's data_interval_end has passed. With catchup=False, the scheduler does not backfill from start_date (2024-01-01); instead it creates a run only for the most recently completed data interval. At 2024-03-15 14:00 UTC, the interval [2024-03-15 00:00, 2024-03-16 00:00) has not ended yet, so it cannot be scheduled. The most recently completed interval is [2024-03-14 00:00, 2024-03-15 00:00), whose end (midnight on the 15th) has already passed. Therefore the first scheduled DAG run has logical_date = 2024-03-14 00:00:00 UTC. The claim that with catchup=False the scheduler still starts from start_date but schedules only one run at a time is wrong because catchup=False skips historical intervals entirely rather than queuing from start_date. The claim that the scheduler creates a run whose data interval contains the current wall-clock time is wrong because the scheduler never schedules a run for an interval that has not yet closed. The claim that the scheduler waits for the next cron tick after the enable time before creating any run is wrong because the scheduler does not skip the already-completed interval; it schedules it immediately rather than waiting for the next cron tick.

In Apache Airflow 2.x (e.g. 2.9), the DAG processor parses each DAG file in a child process and kills the parse after a timeout set by the [core] config option _____ (default 30 seconds). This timeout is not overridden from inside the DAG file. Instead, a cluster-wide hook named _____ defined in airflow_local_settings.py receives the DAG file path and can return a different timeout for that file. Separately, a file is only parsed in safe mode if its source contains the strings airflow and _____ (case-insensitive).#

Show answer

In Apache Airflow 2.x (e.g. 2.9), the DAG processor parses each DAG file in a child process and kills the parse after a timeout set by the [core] config option **dagbag_import_timeout** (default 30 seconds). This timeout is not overridden from inside the DAG file. Instead, a cluster-wide hook named **get_dagbag_import_timeout** defined in airflow_local_settings.py receives the DAG file path and can return a different timeout for that file. Separately, a file is only parsed in safe mode if its source contains the strings airflow and **dag** (case-insensitive).

Why:

[core] dagbag_import_timeout (default 30 seconds) limits how long importing one DAG file may take before the parse is aborted with a timeout error. The per-file adjustment is made by a cluster policy hook, not by the DAG file: a module-level function named get_dagbag_import_timeout(dag_file_path) defined in airflow_local_settings.py can return a timeout for that path, so the second blank is that hook name. With [core] dag_discovery_safe_mode enabled (the default), the file processor skips any file whose contents do not include both airflow and dag (case-insensitive), which is why the third blank is dag.

Related interview questions

Job market

See apache-airflow salaries and hiring demand from live job postings.

Practise these until they stick

That's every question we hold on this topic, and the page marks what you pick. What it can't do is remember. A free account keeps every answer, and what you miss comes back until it's right: after a day, then at longer gaps.

Start with this topic

Free · the whole bank · 100 answers per 30 days, each marked with written feedback

Interview booked? Practise the job ad instead

What moved, monthly

One email a month when the bulletin comes out: what moved in the markets we track, and the new question topics we published. Confirm your address to join. Unsubscribe any time.