potiuk commented on code in PR #37855:
URL: https://github.com/apache/airflow/pull/37855#discussion_r1513780030
##########
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:
Yes. Especially that isinstance is expensive.
--
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]