Class - AggregatorGRPCServer#
- class openfl.transport.grpc.aggregator_server.AggregatorGRPCServer(aggregator, agg_port, use_tls=True, require_client_auth=True, root_certificate=None, certificate=None, private_key=None, root_certificate_refresher_cb=None, **kwargs)[source]#
Bases:
AggregatorServicerAggregator gRPC Server.
- aggregator#
An instance of the Aggregator object that this server is serving.
- Type:
- agg_port#
Port to start gRPC server on.
- Type:
int
- 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
- root_certificate_refresher_cb#
A callback function that receives no arguments and returns the current root certificate.
- Type:
Callable
- __init__(aggregator, agg_port, use_tls=True, require_client_auth=True, root_certificate=None, certificate=None, private_key=None, root_certificate_refresher_cb=None, **kwargs)[source]#
Methods
GetAggregatedTensor(request, context)Request a job from aggregator.
GetTasks(request, context)Request a job from aggregator.
InteropRelay(request, context)Ping(request, context)Ping endpoint of the Aggregator server.
SendLocalTaskResults(*args, **kwargs)Missing associated documentation comment in .proto file.
__init__(aggregator, agg_port[, use_tls, ...])check_request(request)Validate request header matches expected values.
serve()Starts the aggregator gRPC server.
validate_collaborator(request, context)Validate the collaborator.
- GetAggregatedTensor(request, context)[source]#
Request a job from aggregator.
This method handles a request from a collaborator for an aggregated tensor.
- Parameters:
request (aggregator_pb2.GetAggregatedTensorRequest) – The request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Returns:
- The response to the
request.
- Return type:
aggregator_pb2.GetAggregatedTensorResponse
- GetTasks(request, context)[source]#
Request a job from aggregator.
This method handles a request from a collaborator for a job.
- Parameters:
request (aggregator_pb2.GetTasksRequest) – The request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Returns:
The response to the request.
- Return type:
aggregator_pb2.GetTasksResponse
- InteropRelay(request, context)[source]#
- Parameters:
request (aggregator_pb2.InteropRelay) – The request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Returns:
The response to the request.
- Return type:
aggregator_pb2.InteropRelay
- Ping(request, context)[source]#
Ping endpoint of the Aggregator server.
This method handles a ping request from a collaborator.
- Parameters:
request (aggregator_pb2.PingRequest) – The ping request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Returns:
The response to the ping request.
- Return type:
aggregator_pb2.PingResponse
- SendLocalTaskResults(*args, **kwargs)[source]#
Missing associated documentation comment in .proto file.
- check_request(request)[source]#
Validate request header matches expected values.
- This method checks that the request is valid and was sent by an
authorized collaborator.
- Parameters:
request (aggregator_pb2.MessageHeader) – Request sent from a collaborator that requires validation.
- Raises:
ValueError – If the request is not valid.
- validate_collaborator(request, context)[source]#
Validate the collaborator.
This method checks that the collaborator who sent the request is authorized to do so.
- Parameters:
request (aggregator_pb2.MessageHeader) – The request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Raises:
grpc.RpcError – If the collaborator or collaborator certificate is not authorized.