-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
Add missing attrs / correct bad attrs on TaskInstancePydantic #37854
Add missing attrs / correct bad attrs on TaskInstancePydantic #37854
Conversation
af550aa
to
be054bd
Compare
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.
LGTM. Static checks are failing. Can you look into the static checks?
4df2c2c
to
b48f44e
Compare
b8f5f2e
to
a8be0cd
Compare
a8be0cd
to
588519b
Compare
ok @uranusjr @potiuk @eladkal ... In response to the question "why do we need to add defaults to pydantic".... I have have added a default of None to attr this isn't really a straightforward change because (1) mypy doesn't like it and, more importantly, (2) there is logic in airflow that looks at can you take a look and let me know what you think is the better approach? i.e. should we proceed with the changes i've just made, or go back and stick with just adding a default on the pydantic model. |
51c3316
to
402c436
Compare
One was wrong type; others were missing; others needed a default.
2c520d1
to
b8d4b35
Compare
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.
LGTM
…antic (apache#37854) This was motivated by the need to fix serialization of TaskInstance to TaskInstancePydantic. In some cases the data type was wrong; in other cases the attr was missing. In the case of `task` it was more complicated. Historically the value is type-declared but not set at init. So it's not alway there. And in the code base there was a lot of hasattr... The problem here though was that when serializing to TaskInstancePydantic, if the value was not set, then serialization would fail. So we had to make it optional on TaskInstance and provide a default of None.
One was wrong type; others were missing; others needed a default.