openfl.transport.grpc.aggregator_client.AggregatorGRPCClient#
- class openfl.transport.grpc.aggregator_client.AggregatorGRPCClient(agg_addr, agg_port, root_certificate, certificate, private_key, use_tls=True, require_client_auth=True, aggregator_uuid=None, federation_uuid=None, single_col_cert_common_name=None, **kwargs)[source]#
Bases:
objectClient to the aggregator over gRPC-TLS.
This class implements a gRPC client for communicating with an aggregator over a secure (TLS) connection.
- uri#
The URI of the aggregator.
- 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
- aggregator_uuid#
The UUID of the aggregator.
- Type:
str
- federation_uuid#
The UUID of the federation.
- Type:
str
- single_col_cert_common_name#
The common name on the collaborator’s certificate.
- Type:
str
- __init__(agg_addr, agg_port, root_certificate, certificate, private_key, use_tls=True, require_client_auth=True, aggregator_uuid=None, federation_uuid=None, single_col_cert_common_name=None, **kwargs)[source]#
Initialize.
- Parameters:
agg_addr (str) – The address of the aggregator.
agg_port (int) – The port of the aggregator.
use_tls (bool) – Whether to use TLS for the connection.
require_client_auth (bool) – Whether to enable client-side authentication, i.e. mTLS. Ignored if use_tls=False.
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,optional) – The UUID of the aggregator.
federation_uuid (str, optional) – The UUID of the federation.
single_col_cert_common_name (str, optional) – The common name on the collaborator’s certificate.
**kwargs – Additional keyword arguments.
Methods
__init__(agg_addr, agg_port, ...[, use_tls, ...])Initialize.
Set an insecure gRPC channel (i.e. no TLS) if desired.
create_tls_channel(uri, root_certificate, ...)Set an secure gRPC channel (i.e. TLS).
Close the gRPC channel.
get_aggregated_tensor(*args, **kwargs)get_tasks(*args, **kwargs)Create a new channel with the gRPC server.
send_local_task_results(*args, **kwargs)validate_response(reply, collaborator_name)Validate the aggregator response.
- create_insecure_channel(uri)[source]#
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:
An insecure gRPC channel object
- Return type:
grpc.Channel
- create_tls_channel(uri, root_certificate, require_client_auth, certificate, private_key)[source]#
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.
require_client_auth (bool) – True enables client-side authentication.
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:
A secure gRPC channel object
- Return type:
grpc.Channel