0
0
Apache Airflowdevops~10 mins

Default args and DAG parameters in Apache Airflow - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the default start date for the DAG.

Apache Airflow
default_args = {
    'start_date': [1]
}
Drag options to blanks, or click blank then click option'
Adatetime(2023, 1, 1)
Btimedelta(days=1)
Ctimezone('UTC')
Ddatetime.now()
Attempts:
3 left
💡 Hint
Common Mistakes
Using timedelta instead of datetime
Using datetime.now() which is dynamic
2fill in blank
medium

Complete the code to set the DAG's schedule interval to run daily.

Apache Airflow
dag = DAG(
    'example_dag',
    default_args=default_args,
    schedule_interval=[1]
)
Drag options to blanks, or click blank then click option'
A'@hourly'
BNone
C'@weekly'
D'@daily'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '@hourly' or '@weekly' instead of '@daily'
Setting schedule_interval to None disables scheduling
3fill in blank
hard

Fix the error in setting the default retry delay to 5 minutes.

Apache Airflow
default_args = {
    'retry_delay': [1]
}
Drag options to blanks, or click blank then click option'
A5
B'5 minutes'
Ctimedelta(minutes=5)
Dtimedelta(5)
Attempts:
3 left
💡 Hint
Common Mistakes
Passing an integer directly
Using a string instead of timedelta
Using timedelta without specifying minutes
4fill in blank
hard

Fill both blanks to create a DAG with default args and a weekly schedule.

Apache Airflow
dag = DAG(
    'weekly_dag',
    default_args=[1],
    schedule_interval=[2]
)
Drag options to blanks, or click blank then click option'
Adefault_args
B'@daily'
C'@weekly'
DNone
Attempts:
3 left
💡 Hint
Common Mistakes
Using '@daily' instead of '@weekly'
Passing None for default_args
5fill in blank
hard

Fill all three blanks to define default args with retries and create a DAG with a monthly schedule.

Apache Airflow
default_args = {
    'start_date': [1],
    'retries': [2],
    'retry_delay': [3]
}

dag = DAG(
    'monthly_dag',
    default_args=default_args,
    schedule_interval='@monthly'
)
Drag options to blanks, or click blank then click option'
Adatetime(2024, 1, 1)
B3
Ctimedelta(minutes=10)
Dtimedelta(days=1)
Attempts:
3 left
💡 Hint
Common Mistakes
Using strings instead of datetime or timedelta
Setting retries as string
Using timedelta without specifying minutes