Recall & Review
beginner
What is a custom operator in Apache Airflow?
A custom operator is a user-defined class that extends Airflow's BaseOperator to perform specific tasks not covered by built-in operators.Click to reveal answer
beginner
Which method must be implemented when creating a custom operator?
The
execute() method, which contains the code that runs when the operator is triggered.Click to reveal answer
intermediate
How do you pass parameters to a custom operator?
Parameters are passed via the operator's constructor and stored as instance variables to be used in the
execute() method.Click to reveal answer
intermediate
Why should you call
super().__init__() in a custom operator's constructor?To properly initialize the BaseOperator part of the class, ensuring Airflow can manage the operator's lifecycle and features.
Click to reveal answer
beginner
What is the benefit of creating custom operators in Airflow?
They allow you to reuse complex or specific task logic easily across multiple DAGs, improving code organization and maintainability.
Click to reveal answer
What base class should you extend to create a custom operator in Airflow?
✗ Incorrect
Custom operators extend BaseOperator to inherit core operator functionality.
Which method contains the code that runs when a custom operator executes?
✗ Incorrect
The execute() method is called by Airflow to run the operator's task.
Why is calling super().__init__() important in a custom operator?
✗ Incorrect
It ensures the BaseOperator is properly initialized with Airflow's internal setup.
How do you pass custom parameters to your operator?
✗ Incorrect
Parameters are passed when creating the operator instance via its constructor.
What is a main advantage of using custom operators?
✗ Incorrect
Custom operators help reuse complex task logic, making DAGs cleaner and easier to maintain.
Explain the steps to create a custom operator in Airflow.
Think about class inheritance and method overriding.
You got /4 concepts.
Describe why and when you would create a custom operator instead of using built-in ones.
Consider task uniqueness and code reuse.
You got /4 concepts.