openfl.transport.grpc.director_server.DirectorGRPCServer
- class openfl.transport.grpc.director_server.DirectorGRPCServer(*, director_cls, tls: bool = True, root_certificate: Path | str | None = None, private_key: Path | str | None = None, certificate: Path | str | None = None, review_plan_callback: None | Callable = None, listen_host: str = '[::]', listen_port: int = 50051, envoy_health_check_period: int = 0, **kwargs)
Bases:
DirectorServicerDirector transport class.
This class implements a gRPC server for the Director, allowing it to communicate with collaborators.
- Class Attributes:
director (Director) – The director that this server is serving.
listen_uri (str) – The URI that the server is serving on.
tls (bool) – Whether to use TLS for the connection.
root_certificate (Path) – The path to the root certificate for the TLS connection.
private_key (Path) – The path to the server’s private key for the TLS connection.
certificate (Path) – The path to the server’s certificate for the TLS connection.
server (grpc.Server) – The gRPC server.
Methods
Request the info about target and sample shapes in the dataset.
Get a status information about envoys.
Receive experiment data.
Get an experiment description.
Get experiment status and update if experiment was approved.
Get list of experiments description.
Request to stream metrics from the aggregator to frontend.
RPC for retrieving trained models.
Remove experiment data RPC.
Set the experiment failed.
Request to set new experiment.
Accept health check from envoy.
Receive acknowledge shard info.
Request for wait an experiment.
Get caller name from context.
Launch the director GRPC server.
- async GetDatasetInfo(request, context)
Request the info about target and sample shapes in the dataset.
- Parameters:
request (director_pb2.GetDatasetInfoRequest) – The request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Returns:
director_pb2.GetDatasetInfoResponse – The response to the request.
- async GetEnvoys(request, context)
Get a status information about envoys.
- Parameters:
request (director_pb2.GetEnvoysRequest) – The request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Returns:
director_pb2.GetEnvoysResponse – The response to the request.
- async GetExperimentData(request, context)
Receive experiment data.
- Parameters:
request (director_pb2.GetExperimentDataRequest) – The request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Yields:
director_pb2.ExperimentData – The experiment data.
- async GetExperimentDescription(request, context)
Get an experiment description.
- Parameters:
request (director_pb2.GetExperimentDescriptionRequest) – The request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Returns:
director_pb2.GetExperimentDescriptionResponse – The response to the request.
- async GetExperimentStatus(request, context)
Get experiment status and update if experiment was approved.
- Parameters:
request (director_pb2.GetExperimentStatusRequest) – The request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Returns:
director_pb2.GetExperimentStatusResponse – The response to the request.
- async GetExperimentsList(request, context)
Get list of experiments description.
- Parameters:
request (director_pb2.GetExperimentsListRequest) – The request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Returns:
director_pb2.GetExperimentsListResponse – The response to the request.
- async GetMetricStream(request, context)
Request to stream metrics from the aggregator to frontend.
- Parameters:
request (director_pb2.GetMetricStreamRequest) – The request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Yields:
director_pb2.GetMetricStreamResponse – The metrics.
- async GetTrainedModel(request, context)
RPC for retrieving trained models.
- Parameters:
request (director_pb2.GetTrainedModelRequest) – The request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Returns:
director_pb2.TrainedModelResponse – The response to the request.
- async RemoveExperimentData(request, context)
Remove experiment data RPC.
- Parameters:
request (director_pb2.RemoveExperimentRequest) – The request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Returns:
response (director_pb2.RemoveExperimentResponse) – The response to the request.
- async SetExperimentFailed(request, context)
Set the experiment failed.
- Parameters:
request (director_pb2.SetExperimentFailedRequest) – The request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Returns:
response (director_pb2.SetExperimentFailedResponse) – The response to the request.
- async SetNewExperiment(stream, context)
Request to set new experiment.
- Parameters:
stream (grpc.aio._MultiThreadedRendezvous) – The stream of experiment data.
context (grpc.ServicerContext) – The context of the request.
- Returns:
director_pb2.SetNewExperimentResponse – The response to the request.
- async UpdateEnvoyStatus(request, context)
Accept health check from envoy.
- Parameters:
request (director_pb2.UpdateEnvoyStatusRequest) – The request from the envoy.
context (grpc.ServicerContext) – The context of the request.
- Returns:
resp (director_pb2.UpdateEnvoyStatusResponse) – The response to the request.
- async UpdateShardInfo(request, context)
Receive acknowledge shard info.
- Parameters:
request (director_pb2.UpdateShardInfoRequest) – The request from the shard.
context (grpc.ServicerContext) – The context of the request.
- Returns:
reply (director_pb2.UpdateShardInfoResponse) – The response to the request.
- async WaitExperiment(request, context)
Request for wait an experiment.
- Parameters:
request (director_pb2.WaitExperimentRequest) – The request from the collaborator.
context (grpc.ServicerContext) – The context of the request.
- Returns:
director_pb2.WaitExperimentResponse – The response to the request.
- get_caller(context)
Get caller name from context.
if tls == True: get caller name from auth_context if tls == False: get caller name from context header ‘client_id’
- Parameters:
context (grpc.ServicerContext) – The context of the request.
- Returns:
str – The name of the caller.
- start()
Launch the director GRPC server.