nvflare.private.fed.server.fed_server module¶
- class BaseServer(project_name=None, min_num_clients=2, max_num_clients=10, heart_beat_timeout=600, handlers: List[FLComponent] | None = None, shutdown_period=30.0)[source]¶
Bases:
ABC
Base server that provides the clients management and server deployment.
- deploy(args, grpc_args=None, secure_train=False)[source]¶
Start a grpc server and listening the designated port.
- get_all_clients() Dict[str, Client] [source]¶
Get the list of registered clients.
- Returns:
client}
- Return type:
A dict of {client_token
- class FederatedServer(project_name=None, min_num_clients=2, max_num_clients=10, cmd_modules=None, heart_beat_timeout=600, handlers: List[FLComponent] | None = None, args=None, secure_train=False, snapshot_persistor=None, overseer_agent=None, shutdown_period=30.0, check_engine_frequency=3.0)[source]¶
Bases:
BaseServer
Federated server services.
- Parameters:
project_name – server project name.
min_num_clients – minimum number of contributors at each round.
max_num_clients – maximum number of contributors at each round.
cmd_modules – command modules.
heart_beat_timeout – heartbeat timeout
handlers – A list of handler
args – arguments
secure_train – whether to use secure communication
- deploy(args, grpc_args=None, secure_train=False)[source]¶
Start a grpc server and listening the designated port.
- notify_dead_client(client)[source]¶
Called to do further processing of the dead client
- Parameters:
client – the dead client
Returns:
- quit_client(request: Message) Message [source]¶
Existing client quits the federated training process.
Server will stop sharing the global model with the client, further contribution will be rejected.
This function does not change min_num_clients and max_num_clients.
- register_client(request: Message) Message [source]¶
Register new clients on the fly.
Each client must get registered before getting the global model. The server will expect updates from the registered clients for multiple federated rounds.
This function does not change min_num_clients and max_num_clients.