kaxil commented on code in PR #45043:
URL: https://github.com/apache/airflow/pull/45043#discussion_r1891510752


##########
task_sdk/src/airflow/sdk/execution_time/supervisor.py:
##########
@@ -689,7 +692,11 @@ def _handle_request(self, msg, log):
             self._task_end_time_monotonic = time.monotonic()
         elif isinstance(msg, GetConnection):
             conn = self.client.connections.get(msg.conn_id)
-            resp = conn.model_dump_json(exclude_unset=True).encode()
+            if isinstance(conn, ConnectionResponse):
+                conn_result = ConnectionResult.from_conn_response(conn)
+                resp = conn_result.model_dump_json(exclude_unset=True).encode()
+            elif isinstance(conn, ErrorResponse):
+                resp = conn.model_dump_json().encode()

Review Comment:
   I wanted to ensure that it is `ErrorResponse`, but if we have other type of 
msgs, I will replace `elif` with `else`



##########
task_sdk/src/airflow/sdk/execution_time/supervisor.py:
##########
@@ -689,7 +692,11 @@ def _handle_request(self, msg, log):
             self._task_end_time_monotonic = time.monotonic()
         elif isinstance(msg, GetConnection):
             conn = self.client.connections.get(msg.conn_id)
-            resp = conn.model_dump_json(exclude_unset=True).encode()
+            if isinstance(conn, ConnectionResponse):
+                conn_result = ConnectionResult.from_conn_response(conn)
+                resp = conn_result.model_dump_json(exclude_unset=True).encode()
+            elif isinstance(conn, ErrorResponse):
+                resp = conn.model_dump_json().encode()

Review Comment:
   I wanted to ensure that it is `ErrorResponse`, but if we have other type of 
msgs, I will replace `elif` with `else` in the next one



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