dabla commented on code in PR #62922: URL: https://github.com/apache/airflow/pull/62922#discussion_r4243465263
########## task-sdk/src/airflow/sdk/definitions/_internal/expandinput.py: ########## @@ -41,6 +42,96 @@ OperatorExpandKwargsArgument = Union["XComArg", Sequence[Union["XComArg", Mapping[str, Any]]]] +class Resolved(NamedTuple): + """ + An expand input resolved for iteration: its item count and an async read by index. + + The ``.iterate()`` counterpart of ``ExpandInput.resolve``, which hands one mapped task + instance the item at its ``map_index``: every source is pulled once, and ``aget(index)`` then + picks the item an index maps to the way ``resolve`` does for ``.expand()`` (the cross product + of ``iterate(**kwargs)``, the mapping at that position for ``iterate_kwargs``). Reads run on + the task's event loop next to the sub-tasks' own SDK calls, so nothing here may block the loop + thread on the supervisor channel (see ``AsyncAwareExecutor.imap_unordered``). + """ + + length: int + aget: Callable[[int], Awaitable[Mapping[str, Any]]] + + +class Source: + """ + One resolved expand argument, read by index without a blocking supervisor call on the loop. + + A Mapping is read as its ``(key, value)`` pairs and a scalar as a one-item sequence, matching Review Comment: Right, the docstring now says a scalar is refused as `.expand()` refuses it: a literal at parse time, a pushed value by `from_argument` (632cc04d09). Drafted-by: Claude Opus 5.5; reviewed by @dabla before posting -- 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]
