0
0
Apache Airflowdevops~5 mins

Default args and DAG parameters in Apache Airflow - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of default_args in an Airflow DAG?

default_args is a dictionary used to set default parameters for all tasks in a DAG. It helps avoid repeating common settings like retries, start date, or email notifications.

Click to reveal answer
beginner
Name three common parameters you might include in default_args.

Common parameters include start_date, retries, and retry_delay. These control when the DAG starts, how many times to retry a failed task, and the wait time between retries.

Click to reveal answer
intermediate
How do DAG parameters differ from default_args?

DAG parameters are settings that define the DAG itself, like its schedule_interval or description. default_args apply to tasks inside the DAG, setting defaults for task behavior.

Click to reveal answer
intermediate
What happens if you set a start_date in default_args that is in the future?

The DAG will not run until the start_date is reached. Airflow schedules tasks only after this date, so no runs happen before it.

Click to reveal answer
intermediate
How can you override a default_args parameter for a specific task?

You can pass the parameter directly when creating the task. For example, if retries is 3 in default_args, you can set retries=1 in the task to override it.

Click to reveal answer
What is the role of default_args in an Airflow DAG?
ACreate new tasks dynamically
BDefine the DAG's schedule interval
CSet default parameters for all tasks in the DAG
DStore logs of task runs
Which parameter in default_args controls how many times a task retries on failure?
Aretry_delay
Bretries
Cstart_date
Dschedule_interval
If you want a DAG to run every day at midnight, which DAG parameter should you set?
Adefault_args
Bretries
Cstart_date
Dschedule_interval
What happens if a task does not have a parameter set in default_args or in the task itself?
AAirflow uses a global default value
BThe task will fail immediately
CThe DAG will not start
DThe parameter is ignored
How can you specify a different retry delay for a single task than the one in default_args?
ASet <code>retry_delay</code> when defining the task
BChange <code>retry_delay</code> in <code>default_args</code>
CModify the DAG's <code>schedule_interval</code>
DYou cannot override it per task
Explain what default_args is and why it is useful in Airflow DAGs.
Think about how to set common settings for many tasks at once.
You got /3 concepts.
    Describe the difference between DAG parameters and default_args in Airflow.
    One controls the whole workflow, the other controls tasks inside it.
    You got /3 concepts.