[docs]defas_completed(self):""" Return an async iterator that yields results as they complete, similar to asyncio.as_completed(). This method returns an async iterator that yields results in the order they complete, not in the order they were submitted. This can be more efficient when some items take longer to process than others. Note: This method currently just yields items as they come from the source. The real as_completed logic should happen at the pipeline/task level via execution_mode. Returns: AsyncIterable[T]: An async iterator that yields items in completion order """returnself._as_completed_generator()
asyncdef_as_completed_generator(self)->AsyncIterable[T]:"""Internal generator that yields items as they complete."""# Since the stream items are already processed by the pipeline,# and the pipeline handles the execution mode internally,# we just yield them as they come from the source.asyncforiteminself._source:yielditem