service
¤
RoundTrip
module-attribute
¤
RoundTrip: TypeAlias = tuple[RunRequest, RunResponse]
A request to a Dispatch endpoint, and the response that was received.
DispatchService
¤
DispatchService(
endpoint_client: EndpointClient,
api_key: str | None = None,
retry_on_status: set[Status] | None = None,
collect_roundtrips: bool = False,
)
Bases: DispatchServiceServicer
Test instance of Dispatch that provides the bare minimum functionality required to test functions locally.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint_client |
EndpointClient
|
Client to use to interact with the local Dispatch endpoint (that provides the functions). |
required |
api_key |
str | None
|
Expected API key on requests to the service. If omitted, the value of the DISPATCH_API_KEY environment variable is used instead. |
None
|
retry_on_status |
set[Status] | None
|
Set of status codes to enable retries for. |
None
|
collect_roundtrips |
bool
|
Enable collection of request/response round-trips to the configured endpoint. |
False
|
Dispatch
¤
Dispatch(request: DispatchRequest, context)
RPC handler for Dispatch requests. Requests are only queued for processing here.
dispatch_calls
¤
dispatch_calls()
Synchronously dispatch pending function calls to the configured endpoint.
start
¤
start()
Start starts a background thread to continuously dispatch calls to the configured endpoint.