amoghrajesh commented on code in PR #45344:
URL: https://github.com/apache/airflow/pull/45344#discussion_r1900761605


##########
task_sdk/src/airflow/sdk/execution_time/supervisor.py:
##########
@@ -726,7 +727,12 @@ def _handle_request(self, msg: ToSupervisor, log: 
FilteringBoundLogger):
             resp = var_result.model_dump_json().encode()
         elif isinstance(msg, GetXCom):
             xcom = self.client.xcoms.get(msg.dag_id, msg.run_id, msg.task_id, 
msg.key, msg.map_index)
-            xcom_result = XComResult.from_xcom_response(xcom)
+            if isinstance(xcom, XComResponse):
+                xcom_result = XComResult.from_xcom_response(xcom)
+            else:
+                # Airflow 2.x just ignores the absence of an XCom and moves on 
with a return value of None
+                # Hence making this resp with key as `key` and value as None, 
so that the message is sent back to task runner.
+                xcom_result = 
XComResult.from_xcom_response(XComResponse(key=msg.key, value=None))

Review Comment:
   I actually handled it that way and its much simpler and cleaner.



##########
task_sdk/tests/execution_time/test_supervisor.py:
##########
@@ -762,14 +764,15 @@ def watched_subprocess(self, mocker):
         )
 
     @pytest.mark.parametrize(
-        ["message", "expected_buffer", "client_attr_path", "method_arg", 
"mock_response"],
+        ["message", "expected_buffer", "client_attr_path", "method_arg", 
"mock_response", "decoded_buffer"],

Review Comment:
   Not applicable, handled differently



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