-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
Protect against accidental misuse of XCom.get_value() #22244
Protect against accidental misuse of XCom.get_value() #22244
Conversation
138827d
to
b9b1b11
Compare
b9b1b11
to
6161beb
Compare
I'd love to merge it quickly so that I could incorporate this in the changelogs (hidden entry but avoids future release pollution) to include that one. |
@@ -244,7 +244,7 @@ def get_link( | |||
:param dttm: datetime | |||
:return: url link | |||
""" | |||
if ti_key: | |||
if ti_key is not None: |
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.
This makes no difference does it? (since we don't define a custom book on TIKey)
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.
Nope. But it's easier to standardize as convention. Both ways were used in the code and I arbitrary chose not None
as more explicit.
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.
This way we have only one "standard" way to check.
Random doc inventory problem it seems. Reopened to rebuild. |
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. |
The XCom.get_value has been added in 2.3.0 and while there are cases it should be used in the providers when task are mapped, in order to keep compatibility with earlier versions of Airlfow, the XCom.get_value() should only be used when ti_key is not None. We check for the construct used in community providers automatically and also add a documentation for users who would like to use dynamic task mapping featuers in their own providers.
6161beb
to
7421d83
Compare
Rebased to take advantage of the "docs" build fix |
The XCom.get_value has been added in 2.3.0 and while there are
cases it should be used in the providers when task are mapped,
in order to keep compatibility with earlier versions of Airlfow,
the XCom.get_value() should only be used when ti_key is not None.
We check for the construct used in community providers automatically
and also add a documentation for users who would like to use
dynamic task mapping featuers in their own providers.
^ 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.