ashb commented on code in PR #51699:
URL: https://github.com/apache/airflow/pull/51699#discussion_r2150427462


##########
task-sdk/src/airflow/sdk/execution_time/comms.py:
##########
@@ -80,20 +90,152 @@
 )
 from airflow.sdk.exceptions import ErrorType
 
+if TYPE_CHECKING:
+    from structlog.typing import FilteringBoundLogger as Logger
+
+SendMsgType = TypeVar("SendMsgType", bound=BaseModel)
+ReceiveMsgType = TypeVar("ReceiveMsgType", bound=BaseModel)
+
+
+def _msgpack_enc_hook(obj: Any) -> Any:
+    import pendulum
+
+    if isinstance(obj, pendulum.DateTime):
+        # convert the complex to a tuple of real, imag
+        return datetime(
+            obj.year, obj.month, obj.day, obj.hour, obj.minute, obj.second, 
obj.microsecond, tzinfo=obj.tzinfo
+        )

Review Comment:
   This is because we now call `msg.model_dump()` instead of 
`msg.model_dump_json()`, so we now get a dict with Datetime objects etc. We 
need to add something if we add a new message type and it fails to send -- 
it'll be pretty obvious during dev.
   
   I notice the comment on L104 is wrong (i copied it verbatim from the msgspec 
docs)



-- 
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]

Reply via email to