Challenge - 5 Problems
Airflow Operator Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
Purpose of Operators in Airflow
Why do Airflow operators abstract common tasks in workflows?
Attempts:
2 left
💡 Hint
Think about how operators help avoid repeating the same code for similar tasks.
✗ Incorrect
Operators in Airflow are designed as reusable components that represent a single task. They abstract common operations like running a bash command or executing a Python function, making workflows easier to write and maintain.
💻 Command Output
intermediate1:30remaining
Output of BashOperator Execution
What will be the output in Airflow logs when this BashOperator runs?
bash_task = BashOperator(task_id='print_date', bash_command='date')
Attempts:
2 left
💡 Hint
BashOperator runs the command given in bash_command and logs its output.
✗ Incorrect
The BashOperator runs the shell command 'date' and logs the current date and time output.
🔀 Workflow
advanced2:00remaining
Using Operators to Build a Simple Workflow
Given these tasks, which option correctly defines a workflow where
task1 runs before task2 using Airflow operators?task1 = BashOperator(task_id='task1', bash_command='echo Start') task2 = BashOperator(task_id='task2', bash_command='echo End')
Attempts:
2 left
💡 Hint
Use the Airflow bitshift operator to set task dependencies.
✗ Incorrect
In Airflow, the '>>' operator sets the order so that task1 runs before task2.
❓ Troubleshoot
advanced2:00remaining
Error When Using PythonOperator
What error will occur if you define a PythonOperator without passing a callable function to the
python_callable parameter?Attempts:
2 left
💡 Hint
The PythonOperator expects a function to call when the task runs.
✗ Incorrect
If python_callable is None or missing, Airflow tries to call None, causing a TypeError.
✅ Best Practice
expert2:30remaining
Why Use Operators Instead of Raw Scripts in Airflow?
Which is the best reason to use Airflow operators instead of running raw scripts directly in tasks?
Attempts:
2 left
💡 Hint
Think about what Airflow adds beyond just running code.
✗ Incorrect
Operators add features like retries, logging, and task dependencies, making workflows more reliable and maintainable compared to running raw scripts.