openfl.transport.grpc.aggregator_client.AggregatorGRPCClient
- class openfl.transport.grpc.aggregator_client.AggregatorGRPCClient(agg_addr, agg_port, disable_client_auth, root_certificate, certificate, private_key, tls=True, aggregator_uuid=None, federation_uuid=None, single_col_cert_common_name=None, **kwargs)
Bases:
objectClient to the aggregator over gRPC-TLS.
This class implements a gRPC client for communicating with an aggregator over a secure (TLS) connection.
- Class Attributes:
uri (str) – The URI of the aggregator.
tls (bool) – Whether to use TLS for the connection.
disable_client_auth (bool) – Whether to disable client-side authentication.
root_certificate (str) – The path to the root certificate for the TLS connection.
certificate (str) – The path to the client’s certificate for the TLS connection.
private_key (str) – The path to the client’s private key for the TLS connection.
aggregator_uuid (str) – The UUID of the aggregator.
federation_uuid (str) – The UUID of the federation.
single_col_cert_common_name (str) – The common name on the collaborator’s certificate.
Methods
Set an insecure gRPC channel (i.e. no TLS) if desired.
Set an secure gRPC channel (i.e. TLS).
Close the gRPC channel.
get_aggregated_tensorget_tasksCreate a new channel with the gRPC server.
send_local_task_resultsValidate the aggregator response.
- create_insecure_channel(uri)
Set an insecure gRPC channel (i.e. no TLS) if desired.
Warns user that this is not recommended.
- Parameters:
uri (str) – The uniform resource identifier for the insecure channel
- Returns:
grpc.Channel – An insecure gRPC channel object
- create_tls_channel(uri, root_certificate, disable_client_auth, certificate, private_key)
Set an secure gRPC channel (i.e. TLS).
- Parameters:
uri (str) – The uniform resource identifier for the secure channel.
root_certificate (str) – The Certificate Authority filename.
disable_client_auth (bool) – True disables client-side authentication (not recommended, throws warning to user).
certificate (str) – The client certificate filename from the collaborator (signed by the certificate authority).
private_key (str) – The private key filename for the client certificate.
- Returns:
grpc.Channel – A secure gRPC channel object
- disconnect()
Close the gRPC channel.
- reconnect()
Create a new channel with the gRPC server.
- validate_response(reply, collaborator_name)
Validate the aggregator response.
- Parameters:
reply (aggregator_pb2.MessageReply) – The reply from the aggregator.
collaborator_name (str) – The name of the collaborator.