AsyncGraphRunStream(
self,
graph_aiter: AsyncIterator[Any] | None,
mux: StreamMux,
*,| Name | Type | Description |
|---|---|---|
graph_aiter* | AsyncIterator[Any] | None | |
mux* | StreamMux | |
wire_pump | bool | Default: True |
| Name | Type |
|---|---|
| graph_aiter | AsyncIterator[Any] | None |
| mux | StreamMux |
| wire_pump | bool |
Async run stream with caller-driven pumping.
Async iteration on any projection drives the graph forward ā there
is no background task. Concurrent consumers share a single-flight
pump via an asyncio.Lock, so each awaiting cursor contributes one
event per acquisition. Backpressure comes from the logs: when a
subscribed log's buffer reaches maxlen, apush awaits the
subscriber to drain, which holds back the pump and paces the graph.
Projections are single-consumer ā a second aiter(run.values)
raises. Use projection.tee(n) for fan-out.
Use as an async context manager to guarantee clean shutdown on early exit:
async with await handler.astream(input) as run:
async for msg in run.messages:
...
Awaited from Pregel.astream_events(version="v3"), which is
experimental and may change.
Async iterator over the graph's stream, or
None for nested run streams whose pump is driven by
an outer run (e.g. AsyncSubgraphRunStream).
The StreamMux owning projections and the main log.
When True (default), bind _apump_next as the
mux's async pump callable. Subclasses that inherit a
parent pump via StreamMux._make_child should pass
False to preserve the parent binding.
Stop the run early.
Marks the stream exhausted, wakes any pump-waiters, and closes
the mux. Any apush blocked on backpressure wakes and returns
without appending. Idempotent.
Drive the run to completion and return the final state.
Methods (not properties) on the async lane so run.output
without await raises at type-check time instead of silently
yielding a coroutine object.
Drive the run to completion and return whether it was interrupted.
Drive the run to completion and return interrupt payloads.