0
0
Apache Airflowdevops~10 mins

Why testing prevents production DAG failures 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'
Amodels
Boperators
Chooks
Dsensors
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 DAG's start date using datetime.

Apache Airflow
from datetime import datetime
start_date = datetime([1])
Drag options to blanks, or click blank then click option'
A2023, 12, 31
B2024, 1, 1
C2022, 6, 15
D2025, 7, 4
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid date formats or strings instead of integers
3fill in blank
hard

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

Apache Airflow
from airflow.operators.[1] import BashOperator
Drag options to blanks, or click blank then click option'
Abash
Bpython
Cemail
Ddummy
Attempts:
3 left
💡 Hint
Common Mistakes
Importing BashOperator from airflow.operators.python
4fill in blank
hard

Fill both blanks to create a task that runs a bash command and assign it to the DAG.

Apache Airflow
task1 = BashOperator(task_id='print_date', bash_command=[1], dag=[2])
Drag options to blanks, or click blank then click option'
A'date'
Bdag
Cmy_dag
D'echo Hello'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the string 'dag' instead of the DAG object variable
Using wrong bash commands
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that filters tasks with retries greater than 0.

Apache Airflow
filtered_tasks = {task.task_id: task for task in tasks if task.retries [1] [2] and task.owner == [3]
Drag options to blanks, or click blank then click option'
A>
B0
C'airflow'
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong comparison operators
Not quoting the owner string