openfl.transport.grpc.aggregator_client.RetryOnRpcErrorClientInterceptor

class openfl.transport.grpc.aggregator_client.RetryOnRpcErrorClientInterceptor(sleeping_policy, status_for_retry: Tuple[StatusCode] | None = None)

Bases: UnaryUnaryClientInterceptor, StreamUnaryClientInterceptor

Retry gRPC connection on failure.

This class implements a gRPC client interceptor that retries failed RPC calls.

Class Attributes:
  • sleeping_policy (ConstantBackoff) – The backoff policy to use between retries.

  • status_for_retry (Tuple[grpc.StatusCode]) – The gRPC status codes that should trigger a retry.

Methods

intercept_stream_unary

Wrap intercept call for stream->unary RPC.

intercept_unary_unary

Wrap intercept call for unary->unary RPC.

intercept_stream_unary(continuation, client_call_details, request_iterator)

Wrap intercept call for stream->unary RPC.

Parameters:
  • continuation (function) – The original RPC call.

  • client_call_details (grpc.ClientCallDetails) – The details of the call.

  • request_iterator (iterator) – The request messages for the RPC call.

Returns:

grpc.Call – The result of the RPC call.

intercept_unary_unary(continuation, client_call_details, request)

Wrap intercept call for unary->unary RPC.

Parameters:
  • continuation (function) – The original RPC call.

  • client_call_details (grpc.ClientCallDetails) – The details of the call.

  • request (object) – The request message for the RPC call.

Returns:

grpc.Call – The result of the RPC call.