openfl.transport.grpc.director_client.ShardDirectorClient
- class openfl.transport.grpc.director_client.ShardDirectorClient(*, director_host, director_port, shard_name, tls=True, root_certificate=None, private_key=None, certificate=None)
Bases:
objectThe internal director client class.
This class communicates with the director to manage the shard’s participation in the federation.
- Class Attributes:
shard_name (str) – The name of the shard.
stub (director_pb2_grpc.DirectorStub) – The gRPC stub for communication with the director.
Methods
Get an experiment data from the director.
Report shard info to the director.
Send envoy health check.
Set the experiment failed.
Wait an experiment data from the director.
- get_experiment_data(experiment_name)
Get an experiment data from the director.
- Parameters:
experiment_name (str) – The name of the experiment.
- Returns:
data_stream (grpc._channel._MultiThreadedRendezvous) – The data stream of the experiment data.
- report_shard_info(shard_descriptor: Type[ShardDescriptor], cuda_devices: tuple) bool
Report shard info to the director.
- Parameters:
shard_descriptor (Type[ShardDescriptor]) – The descriptor of the shard.
cuda_devices (tuple) – The CUDA devices available on the shard.
- Returns:
acknowledgement (bool) – Whether the report was accepted by the director.
- send_health_check(*, envoy_name: str, is_experiment_running: bool, cuda_devices_info: List[dict] | None = None) int
Send envoy health check.
- Parameters:
envoy_name (str) – The name of the envoy.
is_experiment_running (bool) – Whether an experiment is currently running.
cuda_devices_info (List[dict], optional) – Information about the CUDA devices. Defaults to None.
- Returns:
health_check_period (int) – The period for health checks.
- set_experiment_failed(experiment_name: str, error_code: int = 1, error_description: str = '')
Set the experiment failed.
- Parameters:
experiment_name (str) – The name of the experiment.
error_code (int, optional) – The error code. Defaults to 1.
error_description (str, optional) – The description of the error. Defaults to ‘’.
- wait_experiment()
Wait an experiment data from the director.
- Returns:
experiment_name (str) – The name of the experiment.