ray.serve.handle.DeploymentBroadcastResponse#

class ray.serve.handle.DeploymentBroadcastResponse[source]#

Wraps the results of a broadcast call to all replicas of a deployment.

Collects results from all replicas in parallel. Results are collected from every replica that was live at the time broadcast() was called; replicas added after the call are not included.

Example:

handle = serve.get_deployment_handle("MyDeployment", "app")
response = handle.broadcast("reset_cache")
results = response.results()

PublicAPI (alpha): This API is in alpha and may change before becoming stable.

results(*, timeout_s: float | None = None, return_exceptions: bool = False) List[Any][source]#

Fetch results from all replicas synchronously.

Returns a list of results, one per replica. The order of results is not guaranteed.

Parameters:
  • timeout_s – Timeout in seconds. If None, blocks indefinitely.

  • return_exceptions – If False (default), raise immediately on the first replica exception. If True, collect exceptions in the returned list instead of raising.

Returns:

A list of results, one per replica.

Raises:

TimeoutError – If the timeout is exceeded.

async results_async(*, timeout_s: float | None = None, return_exceptions: bool = False) List[Any][source]#

Fetch results from all replicas asynchronously.

Parameters:
  • timeout_s – Timeout in seconds for the full broadcast collection. If None, waits indefinitely.

  • return_exceptions – If False (default), raise on replica exception. If True, collect exceptions in the returned list instead of raising.

Returns:

A list of results, one per replica.

Raises:

TimeoutError – If the timeout is exceeded.