-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
Update base sensor operator to support XCOM return value #20656
Conversation
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. |
b8c5b6e
to
a12340c
Compare
CC @dstandish since it's in the same vein as the draft PR #20547. Maybe you've already given the thumbs-up somewhere else. |
|
that would be nice |
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.
Nice one. Also it has the potential of being detected by our "min airflow vrsion" CI check (It would fail on import).
Anyone else? @dstandish ?
It's good with me. I recall @potiuk that you were trying to find a way to make it possible to return a tuple. But I think this change should be compatible with that. What we could consider doing is, for 3.0, make it so a sensor must be true / false or PRV (i.e., no longer support "truthy" values) and then in 3.1 we could add support for tuple. WDYT? |
I am good for it actually as is. I think we do not need to do anything more :) . And you should be able to start using it in our community providers even now. The way it should be done is something like:
I think we will figure out the details with the first sensor which will use it (and it will be detected in CI by failing import for 2.1) and we can - then add some pre-commit checks and better information for the developers of providers (but this can be done later). UPDATE: Actually we can make future providers also 100% compatible until they have > 2.3.0. |
Which makes me think.. Well maybe actually we should add a documentation about it. @mingshi-wang - could you please add docs explaininig that this feature (pushing Xcom) is only available in 2.3.0 and add the example of how you can add provider compatible with both pre 2.3.0 and 2.1.0 ? |
Actually I realized that you CAN make it working in community providers INCLUDING XCom Push - simply the provider sensors will have to push the xcom manually until we are > 2.3.0 (which will be ~ December or so. |
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.
Some doc update is needed as discussed.
Sure - I will put in some doc. |
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
Inspired by the idea of #20547, this PR is to update the base sensor operator such that an optional XCom value can be returned and pushed when the operator is executed. Users only need to override the poke() method to return a PokeReturnValue object that encapsulates the XCOM value.
related: #20323
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.