Class - RetryOnRpcErrorClientInterceptor#

class openfl.transport.grpc.aggregator_client.RetryOnRpcErrorClientInterceptor(sleeping_policy, status_for_retry=None)[source]#

Bases: UnaryUnaryClientInterceptor, StreamUnaryClientInterceptor

Retry gRPC connection on failure.

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

Parameters:

status_for_retry (Tuple[StatusCode] | None)

sleeping_policy#

The backoff policy to use between retries.

Type:

ConstantBackoff

status_for_retry#

The gRPC status codes that should trigger a retry.

Type:

Tuple[grpc.StatusCode]

__init__(sleeping_policy, status_for_retry=None)[source]#

Initialize function for gRPC retry.

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

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

Methods

__init__(sleeping_policy[, status_for_retry])

Initialize function for gRPC retry.

intercept_stream_unary(continuation, ...)

Wrap intercept call for stream->unary RPC.

intercept_unary_unary(continuation, ...)

Wrap intercept call for unary->unary RPC.

intercept_stream_unary(continuation, client_call_details, request_iterator)[source]#

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:

The result of the RPC call.

Return type:

grpc.Call

intercept_unary_unary(continuation, client_call_details, request)[source]#

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:

The result of the RPC call.

Return type:

grpc.Call