-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Handle json encoding of V1Pod in task callback #27609
Conversation
0d48933
to
bd0521c
Compare
bd0521c
to
e18366b
Compare
Why don't we use |
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
35839ea
to
1598796
Compare
Seemed like a good idea so I explored it just now. The problem is that AirflowJsonEncoder is only one way -- there's no AirflowJsonDecoder that will get you back the same object. For example, when encoding a pod, it doesn't store anywhere the information that the json came from a v1pod so when decoding the json you would just get back dict of plain json-compatible objects. So, we cannot use this approach. HOWEVER... with some adjustments, we can use BaseSerialization. Not sure if this is any better but, i've taken a crack at it. @uranusjr what do you think is better? Currently PR is converting to use BaseSerialization. The original approach remains visible at https://github.com/apache/airflow/compare/main..15987961421ea5aa3c05b429c068cec85c55b774 |
airflow/models/taskinstance.py
Outdated
@@ -2571,6 +2571,7 @@ def __eq__(self, other): | |||
return NotImplemented | |||
|
|||
def as_dict(self): | |||
warnings.warn("This method is deprecated. Use BaseSerialization.serialize.", DeprecationWarning) |
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.
Probably should have stacklevel=2
to make the warning show the previous stack?
Resolves #27593