Fix returned value when ShortCircuitOperator condition is falsy#32569
Merged
Conversation
Signed-off-by: Hussein Awala <[email protected]>
Signed-off-by: Hussein Awala <[email protected]>
hussein-awala
commented
Jul 12, 2023
| tis = dr.get_task_instances() | ||
| assert tis[0].xcom_pull(task_ids=short_op_push_xcom.task_id, key="return_value") == "signature" | ||
| assert tis[0].xcom_pull(task_ids=short_op_no_push_xcom.task_id, key="return_value") is None | ||
| assert tis[0].xcom_pull(task_ids=short_op_no_push_xcom.task_id, key="return_value") is False |
Member
Author
There was a problem hiding this comment.
Is this considered a breaking change? If yes, how do you think we can handle it?
Member
|
I’m not saying this change is wrong, but maybe |
Member
Agree with the title, but maybe the "multiple-outputs"= None should be a separate thing- this one seems to to fix the problem with very small fix to make it more likely to get into maybe even 2.6.4 |
potiuk
approved these changes
Jul 15, 2023
1 task
Member
|
Added issue for it #32622 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes: #32553
Currently when we the python callable in the short circuit operator returns an non empty list or dict (truthy object), we return it without skipping the downstream tasks. And when it returns a falsy object like an empty dict, we evaluate it as a False and we skip the downstream tasks, but we return nothing, which is similar to return
None.This returned
Noneraise an exception when we use the decorator withmultiple_outputs=True, the only way to skip the downstream tasks is returning an empty dict, but the returnedNonebrakes the post-processing method which push the returned Xcom. This PR returns the callable result as it is to fix this problem and to avoid any future problem.^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an 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 a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.