0
0
Apache Airflowdevops~10 mins

Why operators abstract common tasks 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 base class for Airflow operators.

Apache Airflow
from airflow.operators.[1] import BaseOperator
Drag options to blanks, or click blank then click option'
Abash
Bemail
Cpython
Dbase
Attempts:
3 left
💡 Hint
Common Mistakes
Importing from a specific operator module like bash or python instead of base.
Misspelling the module name.
2fill in blank
medium

Complete the code to define a simple PythonOperator task.

Apache Airflow
task = PythonOperator(task_id='print_hello', python_callable=[1])
Drag options to blanks, or click blank then click option'
Aprint('hello')
Bprint_hello()
Cprint_hello
Dhello
Attempts:
3 left
💡 Hint
Common Mistakes
Adding parentheses which calls the function immediately.
Passing a string instead of a function reference.
3fill in blank
hard

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

Apache Airflow
dag = DAG('example_dag', [1], schedule_interval='@daily')
Drag options to blanks, or click blank then click option'
Adefault_args
Bargs
Cdefault_args_dict
Ddefault_args={}
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect parameter names like args.
Passing an empty dictionary directly in the argument list.
4fill in blank
hard

Fill both blanks to create a BashOperator that runs a simple command.

Apache Airflow
task = BashOperator(task_id='run_echo', bash_command=[1], dag=[2])
Drag options to blanks, or click blank then click option'
A'echo Hello World'
B'ls -l'
Cdag
Dmy_dag
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the command without quotes.
Passing a string instead of the DAG object for the dag argument.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that filters tasks by owner.

Apache Airflow
owner_tasks = {task.task_id: task for task in tasks if task.owner [1] [2]
Drag options to blanks, or click blank then click option'
A==
B'airflow'
C!=
D'admin'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong comparison operator.
Using the wrong owner string.