Class - AggregatorGRPCClient#

class openfl.transport.grpc.aggregator_client.AggregatorGRPCClient(agg_addr, agg_port, aggregator_uuid, federation_uuid, collaborator_name, use_tls=True, require_client_auth=True, root_certificate=None, certificate=None, private_key=None, single_col_cert_common_name=None, refetch_server_cert_callback=None, enable_atomic_connections=False, resend_data_on_reconnection=True, **kwargs)[source]#

Bases: AggregatorClientInterface

Collaborator-side gRPC client that talks to the aggregator.

This class implements a gRPC client for communicating with an aggregator.

Parameters:
  • aggregator_uuid (str)

  • federation_uuid (str)

  • collaborator_name (str)

agg_addr#

Aggregator address.

Type:

str

agg_port#

Aggregator port.

Type:

int

aggregator_uuid#

The UUID of the aggregator.

Type:

str

federation_uuid#

The UUID of the federation.

Type:

str

collaborator_name#

The common name of this collaborator.

Type:

str

use_tls#

Whether to use TLS for the connection.

Type:

bool

require_client_auth#

Whether to enable client-side authentication, i.e. mTLS. Ignored if use_tls=False.

Type:

bool

root_certificate#

The path to the root certificate for the TLS connection, ignored if use_tls=False.

Type:

str

certificate#

The path to the client’s certificate for the TLS connection, ignored if use_tls=False.

Type:

str

private_key#

The path to the client’s private key for the TLS connection, ignored if use_tls=False.

Type:

str

single_col_cert_common_name#

The common name on the collaborator’s certificate.

Type:

str

refetch_server_cert_callback#

Callback function to refetch the server certificate.

Type:

function

enable_atomic_connections#

Whether to use atomic connections (i.e. creates a new gRPC channel for each transaction and closes them immediately).

Type:

bool

resend_data_on_reconnection#

Whether to resend data on reconnection.

Type:

bool

__init__(agg_addr, agg_port, aggregator_uuid, federation_uuid, collaborator_name, use_tls=True, require_client_auth=True, root_certificate=None, certificate=None, private_key=None, single_col_cert_common_name=None, refetch_server_cert_callback=None, enable_atomic_connections=False, resend_data_on_reconnection=True, **kwargs)[source]#
Parameters:
  • aggregator_uuid (str)

  • federation_uuid (str)

  • collaborator_name (str)

Methods

__init__(agg_addr, agg_port, ...[, use_tls, ...])

disconnect()

Close the gRPC channel.

get_aggregated_tensor(*args, **kwargs)

Retrieves the aggregated tensor.

get_tasks(*args, **kwargs)

Retrieves tasks for the given collaborator client.

ping(*args, **kwargs)

Ping the aggregator to check connectivity.

reconnect()

Create a new channel with the gRPC server.

send_local_task_results(*args, **kwargs)

Sends local task results.

send_message_to_server(*args, **kwargs)

Forwards a converted message from the local client to the OpenFL server and returns the response. :param openfl_message: The converted message to be sent to the OpenFL server (InteropMessage proto). :param collaborator_name: The name of the collaborator.

validate_response(response)

Validate the aggregator response.

disconnect()[source]#

Close the gRPC channel.

get_aggregated_tensor(*args, **kwargs)[source]#

Retrieves the aggregated tensor.

get_tasks(*args, **kwargs)[source]#

Retrieves tasks for the given collaborator client. Returns a tuple: (tasks, round_number, sleep_time, time_to_quit)

ping(*args, **kwargs)[source]#

Ping the aggregator to check connectivity.

reconnect()[source]#

Create a new channel with the gRPC server.

send_local_task_results(*args, **kwargs)[source]#

Sends local task results. :param collaborator_name: Name of the collaborator. :param round_number: The current round. :param task_name: Name of the task. :param data_size: Size of the data. :param named_tensors: A list of tensors (or named tensor objects).

Returns a SendLocalTaskResultsResponse.

send_message_to_server(*args, **kwargs)[source]#

Forwards a converted message from the local client to the OpenFL server and returns the response. :param openfl_message: The converted message to be sent to the OpenFL server (InteropMessage

proto).

Parameters:

collaborator_name – The name of the collaborator.

Returns:

The response from the OpenFL server (InteropMessage proto).

validate_response(response)[source]#

Validate the aggregator response.