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


##########
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 briefly gave it some thought and thought that the client shouldn't have to 
handle such a scenario. But now that I think about it, that will significantly 
simplify it



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