-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Implement enough interface for MappedOperator to be baggable #20945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
airflow/models/base.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyone else find it odd that Operator is "lower level" than BaseOperator 😁
c1fd8bc to
20c98a3
Compare
airflow/models/baseoperator.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change from a collection to a sequence? (This might cause knock-on impacts for typing of all other operators)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s the other way around, from Sequence to a Collection; Collection is looser than Sequence and should work in subclasses (I think; we can always change this back).
|
Oh that’s a simple yet difficult-to-spot oversight. Everything should be working now! |
99c78e1 to
c4f8d89
Compare
|
As an unrelated discovery, we can sort of trace what we need to check/change to account for MappedOperator by adding annotation to |
c4f8d89 to
08becd9
Compare
airflow/models/baseoperator.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could choose to make them writable properties that affect the slot in partial_kwargs couldn't we?
@weight_rule.setter
def _set_weigh_rule(self, value):
self.partial_kwargs['weight_rule'] = valueThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm yeah theoratically (and maybe also a deleter for Mypy). I’ll investigate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, Mypy is not smart enough unfortunately python/mypy#4125.
We can’t use the Protocol workaround mentioned in the issue either because BaseOperator has a custom metaclass, while Protocol is also implemented with metaclass, and the two would conflict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type ignore it is the other option?
|
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
|
(Documenting for myself on Monday) This is currently failing with |
|
We also need |
|
|
0dece2f to
3cec6d6
Compare
3cec6d6 to
1d21f86
Compare
27bab1f to
d56bf4d
Compare
|
Only failure is an actual timing error: Good to go now! |
The tests are changed to actually bag mapped tasks so we can test they are actually compatible.