scheduler
¤
CoroutineResult
dataclass
¤
CoroutineResult(
coroutine_id: CoroutineID,
value: Optional[Any] = None,
error: Optional[Exception] = None,
call: Optional[Call] = None,
status: Status = Status.OK,
)
The result from running a coroutine to completion.
CallResult
dataclass
¤
CallResult(
call_id: CallID,
value: Optional[Any] = None,
error: Optional[Exception] = None,
)
The result of an asynchronous function call.
CallFuture
dataclass
¤
CallFuture(
result: Optional[CallResult] = None,
first_error: Optional[Exception] = None,
)
A future result of a dispatch.coroutine.call() operation.
AllFuture
dataclass
¤
AllFuture(
order: List[CoroutineID] = list(),
waiting: Set[CoroutineID] = set(),
results: Dict[CoroutineID, CoroutineResult] = dict(),
first_error: Optional[Exception] = None,
)
A future result of a dispatch.coroutine.all() operation.
AnyFuture
dataclass
¤
AnyFuture(
order: List[CoroutineID] = list(),
waiting: Set[CoroutineID] = set(),
first_result: Optional[CoroutineResult] = None,
errors: Dict[CoroutineID, Exception] = dict(),
generic_error: Optional[Exception] = None,
)
A future result of a dispatch.coroutine.any() operation.
RaceFuture
dataclass
¤
RaceFuture(
waiting: Set[CoroutineID] = set(),
first_result: Optional[CoroutineResult] = None,
first_error: Optional[Exception] = None,
)
A future result of a dispatch.coroutine.race() operation.
Coroutine
dataclass
¤
Coroutine(
id: CoroutineID,
parent_id: Optional[CoroutineID],
coroutine: Union[DurableCoroutine, DurableGenerator],
result: Optional[Future] = None,
)
An in-flight coroutine.
State
dataclass
¤
State(
version: str,
suspended: Dict[CoroutineID, Coroutine],
ready: List[Coroutine],
next_coroutine_id: int,
next_call_id: int,
prev_callers: List[Coroutine],
outstanding_calls: int,
)
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: Optional[int] = 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 |
Optional[int]
|
Maximum amount of time to suspend coroutines while waiting for call results. Optional. |
None
|