0
0
Apache Airflowdevops~10 mins

Why best practices prevent technical debt in Apache Airflow - Test Your Understanding

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

Complete the code to import the Airflow DAG class.

Apache Airflow
from airflow.[1] import DAG
Drag options to blanks, or click blank then click option'
Ahooks
Boperators
Cmodels
Dutils
Attempts:
3 left
💡 Hint
Common Mistakes
Importing DAG from airflow.operators instead of airflow.models.
2fill in blank
medium

Complete the code to set the default arguments for the DAG.

Apache Airflow
default_args = {
    'owner': 'airflow',
    'start_date': [1]
}
Drag options to blanks, or click blank then click option'
Adatetime(2023, 1, 1)
Bdatetime.now()
Cdatetime.today()
Ddatetime.utcnow()
Attempts:
3 left
💡 Hint
Common Mistakes
Using datetime.now() causes DAG to run repeatedly from current time.
3fill in blank
hard

Fix the error in the task definition by completing the operator name.

Apache Airflow
task1 = [1](
    task_id='print_date',
    dag=dag
)
Drag options to blanks, or click blank then click option'
APythonOperator
BDummyOperator
CEmailOperator
DBashOperator
Attempts:
3 left
💡 Hint
Common Mistakes
Using PythonOperator without defining a python_callable.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that filters tasks with retries greater than 1.

Apache Airflow
filtered_tasks = {task.task_id: task for task in tasks if task.[1] [2] 1}
Drag options to blanks, or click blank then click option'
Aretries
B>
C<
Dtask_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using task_id instead of retries for filtering.
5fill in blank
hard

Fill all three blanks to create a dictionary of task_ids and owners for tasks that are active.

Apache Airflow
active_tasks = {task.[1]: task.[2] for task in tasks if task.[3] == True}
Drag options to blanks, or click blank then click option'
Atask_id
Bowner
Cis_active
Dstart_date
Attempts:
3 left
💡 Hint
Common Mistakes
Using start_date instead of is_active for filtering.