-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Fix mapped tasks partial arguments when DAG default args are provided #29913
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
Fix mapped tasks partial arguments when DAG default args are provided #29913
Conversation
|
cc: @uranusjr . This definitely needs your insight :) |
…pport None as accepted value
|
May be related: #29366 |
uranusjr
left a comment
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.
I added a commit to tweak the merging part. Should not affect the functionality, I think, but please take another look to make sure.
This should improve iteration a bit, I think.
819b262 to
cd142b6
Compare
bb92fe4 to
7a59ec7
Compare
…#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)
…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. |
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.