Skip to content

4. Retry the Flaky API, Not the Bad Data

Difficulty: Medium · Topic: Retries & failures

The DAG fx_rates runs @daily from 2026-01-01 (no catchup) with three BashOperator tasks in a chain:

Put the shared retry policy in default_args. The tests make some attempts fail and check how many tries each task took and when each one finished.

Your DAG file is run in a simulation of the Airflow 3 scheduler against 5 scenarios, including hidden ones.

Sample scenario: The API times out twice

Deployed 2026-01-10 00:30 UTC, read at 2026-01-10 02:00 UTC.

Expected runs

Hints

Hint 1default_args={"retries": 3, "retry_delay": timedelta(minutes=2)} applies to every task in the DAG.
Hint 2An argument passed to the operator wins over default_args: retries=0 on one task turns retrying off for it.
Hint 3retries=3 means up to 4 tries in all. Without retry_delay, Airflow waits 5 minutes between tries.

Learn the concepts

More Airflow problems

All Airflow problems · Learn Airflow