uranusjr commented on code in PR #59104:
URL: https://github.com/apache/airflow/pull/59104#discussion_r2639094097
##########
airflow-core/src/airflow/models/taskinstance.py:
##########
@@ -1896,6 +1896,32 @@ def xcom_pull(
).first()
if first is None: # No matching XCom at all.
return default
+
+ # Check if the task is actually mapped
+ target_task_id = task_ids if isinstance(task_ids, str) else
first.task_id
+ is_actually_mapped = False
+
+ try:
+ # Get the task definition from the DAG
+ if self.task and self.task.dag:
+ dag = self.task.dag
+ if dag.has_task(target_task_id):
+ target_task = dag.task_dict[target_task_id]
+ is_actually_mapped = getattr(target_task, "is_mapped",
False)
+ except (AttributeError, KeyError):
+ # If we can't determine, assume it's not mapped
+ is_actually_mapped = False
Review Comment:
When does AttributeError happen?
I understand KeyError can happen during `task_dict` access, but that also
_shouldn’t_ happen if the `has_task` check passes. Perhaps we should simply not
catch any exceptions here since they would hint a bigger inconsistency issue.
--
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]