dstandish commented on code in PR #37855:
URL: https://github.com/apache/airflow/pull/37855#discussion_r1511844501
##########
airflow/serialization/serialized_objects.py:
##########
@@ -528,17 +528,17 @@ def serialize(
def _pydantic_model_dump(model_cls: type[BaseModel], var: Any) ->
dict[str, Any]:
return model_cls.model_validate(var).model_dump(mode="json")
# type: ignore[attr-defined]
- if isinstance(var, Job):
+ if isinstance(var, (Job, JobPydantic)):
return cls._encode(_pydantic_model_dump(JobPydantic, var),
type_=DAT.BASE_JOB)
- elif isinstance(var, TaskInstance):
Review Comment:
@uranusjr @potiuk it does feel a little fishy having to do this tuple check
everywhere.... should there be some kind of shared base class or something?
maybe ALL of these if statements could be consolidated to one check along
the lines of
"if this is a thing that we have a pydantic model for, then serialize to
pydantic model, and if it's the pydantic model, do the same thing"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]