openfl.transport.grpc.director_client.DirectorClient
- class openfl.transport.grpc.director_client.DirectorClient(*, client_id: str, director_host: str, director_port: int, tls: bool, root_certificate: str, private_key: str, certificate: str)
Bases:
objectDirector client class for users.
This class communicates with the director to manage the user’s participation in the federation.
- Class Attributes:
stub (director_pb2_grpc.DirectorStub) – The gRPC stub for communication with the director.
Methods
Get best model method.
Request the dataset info from the director.
Get envoys info.
Get experiment info.
Check if the experiment was accepted by the director.
Get experiments list.
Get last model method.
Remove experiment data RPC.
Send the new experiment to director to launch.
Stream metrics RPC.
- get_best_model(experiment_name)
Get best model method.
- Parameters:
experiment_name (str) – The name of the experiment.
- Returns:
Dict[str, numpy.ndarray] – The best model.
- get_dataset_info()
Request the dataset info from the director.
- Returns:
Tuple[List[int], List[int]] – The sample shape and target shape of the dataset.
- get_envoys(raw_result=False)
Get envoys info.
- Parameters:
raw_result (bool, optional) – Whether to return the raw result. Defaults to False.
- Returns:
result (Union[director_pb2.GetEnvoysResponse, – Dict[str, Dict[str, Any]]]): The envoys info.
- get_experiment_description(name)
Get experiment info.
- Parameters:
name (str) – The name of the experiment.
- Returns:
director_pb2.ExperimentDescription – The description of the experiment.
- get_experiment_status(experiment_name)
Check if the experiment was accepted by the director.
- Parameters:
experiment_name (str) – The name of the experiment.
- Returns:
resp (director_pb2.GetExperimentStatusResponse) – The response from the director.
- get_experiments_list()
Get experiments list.
- Returns:
List[str] – The list of experiments.
- get_last_model(experiment_name)
Get last model method.
- Parameters:
experiment_name (str) – The name of the experiment.
- Returns:
Dict[str, numpy.ndarray] – The last model.
- remove_experiment_data(name)
Remove experiment data RPC.
- Parameters:
name (str) – The name of the experiment.
- Returns:
bool – Whether the removal was acknowledged.
- set_new_experiment(name, col_names, arch_path, initial_tensor_dict=None)
Send the new experiment to director to launch.
- Parameters:
name (str) – The name of the experiment.
col_names (List[str]) – The names of the collaborators.
arch_path (str) – The path to the architecture.
initial_tensor_dict (dict, optional) – The initial tensor dictionary. Defaults to None.
- Returns:
resp (director_pb2.SetNewExperimentResponse) – The response from the director.
- stream_metrics(experiment_name)
Stream metrics RPC.
- Parameters:
experiment_name (str) – The name of the experiment.
- Yields:
Dict[str, Any] – The metrics.