ashb commented on code in PR #73005:
URL: https://github.com/apache/airflow/pull/73005#discussion_r3993170278
##########
devel-common/src/tests_common/test_utils/mapping.py:
##########
@@ -18,31 +18,68 @@
from typing import TYPE_CHECKING
-from airflow.models.taskmap import TaskMap
+from sqlalchemy import select
+
+from airflow.models.taskinstance import TaskInstance
+from airflow.models.xcom import XCOM_RETURN_KEY, XComModel
if TYPE_CHECKING:
+ from collections.abc import Collection, Sequence
+
from sqlalchemy.orm import Session
from airflow.serialization.definitions.mappedoperator import Operator
+def push_mapped_length(ti: TaskInstance, value: Collection, *, session:
Session) -> None:
+ """Record ``value`` as ``ti``'s return value, usable as an expansion
input."""
+ XComModel.set(
+ key=XCOM_RETURN_KEY,
+ value=list(value),
Review Comment:
Given this is only in tests, and today, only list values can be mapped, this
is fine, but I'll guard against 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]