Skip to content

scheduler ¤

CoroutineResult dataclass ¤

The result from running a coroutine to completion.

CallResult dataclass ¤

The result of an asynchronous function call.

CallFuture dataclass ¤

A future result of a dispatch.coroutine.call() operation.

GatherFuture dataclass ¤

A future result of a dispatch.coroutine.gather() operation.

Coroutine dataclass ¤

An in-flight coroutine.

State dataclass ¤

State of the scheduler and the coroutines it's managing.

OneShotScheduler ¤

OneShotScheduler(
    entry_point: Callable,
    version: str = sys.version,
    poll_min_results: int = 1,
    poll_max_results: int = 10,
    poll_max_wait_seconds: int | None = None,
)

Scheduler for local coroutines.

It's a one-shot scheduler because it only runs one round of scheduling. When all local coroutines are suspended, the scheduler yields to Dispatch to take over scheduling asynchronous calls.

Parameters:

Name Type Description Default
entry_point Callable

Entry point for the main coroutine.

required
version str

Version string to attach to scheduler/coroutine state. If the scheduler sees a version mismatch, it will respond to Dispatch with an INCOMPATIBLE_STATE status code.

version
poll_min_results int

Minimum number of call results to wait for before coroutine execution should continue. Dispatch waits until this many results are available, or the poll_max_wait_seconds timeout is reached, whichever comes first.

1
poll_max_results int

Maximum number of calls to receive from Dispatch per request.

10
poll_max_wait_seconds int | None

Maximum amount of time to suspend coroutines while waiting for call results. Optional.

None