0
0
Apache Airflowdevops~10 mins

Why orchestration is needed for data pipelines 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 define a simple Airflow DAG with a start date.

Apache Airflow
from airflow import DAG
from datetime import datetime

dag = DAG('example_dag', start_date=[1])
Drag options to blanks, or click blank then click option'
Adatetime(2023, 1, 1)
Bdatetime.now()
Cdate.today()
Ddatetime.today()
Attempts:
3 left
💡 Hint
Common Mistakes
Using dynamic dates like datetime.now() causes scheduling issues.
2fill in blank
medium

Complete the code to import the operator needed to run a Bash command in Airflow.

Apache Airflow
from airflow.operators.[1] import BashOperator
Drag options to blanks, or click blank then click option'
Abash
Bpython
Cshell
Dcommand
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'python' or 'shell' instead of 'bash' causes import errors.
3fill in blank
hard

Fix the error in the DAG definition by completing the missing argument for the BashOperator.

Apache Airflow
task1 = BashOperator(task_id='print_date', bash_command=[1], dag=dag)
Drag options to blanks, or click blank then click option'
Aprint('date')
B'date'
Cdate
D'print date'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing unquoted commands or Python print statements causes runtime errors.
4fill in blank
hard

Fill both blanks to set task dependencies so task1 runs before task2.

Apache Airflow
task1 [1] task2

task1.[2]
Drag options to blanks, or click blank then click option'
A>>
Bset_downstream(task2)
C<<
Dset_upstream(task1)
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<<' or 'set_upstream()' reverses the order of execution.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that filters tasks with priority > 5.

Apache Airflow
high_priority_tasks = {task_id: priority for task_id, priority in tasks.items() if priority [1] [2]

print(high_priority_tasks.get([3], 'Not found'))
Drag options to blanks, or click blank then click option'
A>
B5
C'task_1'
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of '>' changes the filter logic.
Using a wrong task ID causes 'Not found' output.