uranusjr commented on code in PR #59104:
URL: https://github.com/apache/airflow/pull/59104#discussion_r2870624542
##########
airflow-core/src/airflow/models/taskinstance.py:
##########
@@ -1897,6 +1897,27 @@ 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
+ # 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 = bool(getattr(target_task,
"is_mapped", False))
Review Comment:
I’m not sure if this is reliable when fetching an old ti if you change a
task from mapped to not mapped (or the other way around). It’s probably more
reliable to fetch this directly from the `first` instead; if `first.map_index <
0`, the task is not mapped; otherwise it’s mapped.
--
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]