Fix mapped tasks partial arguments when DAG default args are provided#29913
Merged
hussein-awala merged 13 commits intoapache:mainfrom Apr 14, 2023
Merged
Fix mapped tasks partial arguments when DAG default args are provided#29913hussein-awala merged 13 commits intoapache:mainfrom
hussein-awala merged 13 commits intoapache:mainfrom
Conversation
Member
|
cc: @uranusjr . This definitely needs your insight :) |
uranusjr
reviewed
Mar 10, 2023
uranusjr
reviewed
Mar 10, 2023
…pport None as accepted value
2 tasks
Member
|
May be related: #29366 |
uranusjr
reviewed
Mar 13, 2023
uranusjr
approved these changes
Apr 10, 2023
Member
uranusjr
left a comment
There was a problem hiding this comment.
I added a commit to tweak the merging part. Should not affect the functionality, I think, but please take another look to make sure.
hussein-awala
commented
Apr 10, 2023
This should improve iteration a bit, I think.
819b262 to
cd142b6
Compare
bb92fe4 to
7a59ec7
Compare
potiuk
approved these changes
Apr 14, 2023
ephraimbuddy
pushed a commit
that referenced
this pull request
Apr 14, 2023
…#29913) * Add a failing test to make it pass * use partial_kwargs when they are provide and override only None values by dag default values * update the test and check if the values are filled in the right order * fix overriding retry_delay with default value when it is equal to 0 * add missing default value for inlets and outlets * set partial_kwargs dict type to dict[str, Any] and remove type ignore comments * create a dict for default values and use NotSet instead of None to support None as accepted value * update partial typing by removing None type from some args and set NotSet for all args * Tweak kwarg merging slightly This should improve iteration a bit, I think. * Fix unit tests --------- Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com> (cherry picked from commit f01051a)
wookiist
pushed a commit
to wookiist/airflow
that referenced
this pull request
Apr 19, 2023
…apache#29913) * Add a failing test to make it pass * use partial_kwargs when they are provide and override only None values by dag default values * update the test and check if the values are filled in the right order * fix overriding retry_delay with default value when it is equal to 0 * add missing default value for inlets and outlets * set partial_kwargs dict type to dict[str, Any] and remove type ignore comments * create a dict for default values and use NotSet instead of None to support None as accepted value * update partial typing by removing None type from some args and set NotSet for all args * Tweak kwarg merging slightly This should improve iteration a bit, I think. * Fix unit tests --------- Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
|
Is there any reason this fix wouldn't work with branch decorator also? I'm on All downstream mapped tasks fail with: |
|
If I remove the default_args it runs okay. |
2 tasks
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: #29903
Currently the
BaseOperatoroverrides the mapped tasks partial arguments by DAG default args when they are provided regardless the value of partial arguments, but by definition, Airflow should uses these default args only when the operator argument is not provided.This PR fills the
partial_kwargsdictionary with the arguments and kwargs of the partial method, and then just replaces the None values with the default arguments values.