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: Optional[List[FLComponent]] = None)[source]

Bases: ABC

Base server that provides the clients management and server deployment.

client_cleanup()[source]
close()[source]

Shutdown the server.

deploy(args, grpc_args=None, secure_train=False)[source]

Start a grpc server and listening the designated port.

fl_shutdown()[source]
get_all_clients()[source]
abstract remove_client_data(token)[source]
remove_dead_clients()[source]
set_admin_server(admin_server)[source]
class FederatedServer(project_name=None, min_num_clients=2, max_num_clients=10, wait_after_min_clients=10, cmd_modules=None, heart_beat_timeout=600, handlers: Optional[List[FLComponent]] = None, args=None, secure_train=False, enable_byoc=False, snapshot_persistor=None, overseer_agent=None)[source]

Bases: BaseServer, FederatedTrainingServicer, AdminCommunicatingServicer

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.

  • wait_after_min_clients – wait time after minimum clients responded.

  • cmd_modules – command modules.

  • heart_beat_timeout – heartbeat timeout

  • handlers – A list of handler

  • args – arguments

  • secure_train – whether to use secure communication

  • enable_byoc – whether to enable custom components

AuxCommunicate(request, context)[source]

Handle auxiliary channel communication.

GetTask(request, context)[source]

Process client’s get task request.

Heartbeat(request, context)[source]

client to server heartbeat keep live

Quit(request, context)[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(request, context)[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.

Retrieve(request, context)[source]

client retrieve requests.

SendReply(request, context)[source]

client send reply to server

SendResult(request, context)[source]

client send process results to server

SubmitUpdate(request, context)[source]

Handle client’s submission of the federated updates.

abort_run()[source]
close()[source]

Shutdown the server.

deploy(args, grpc_args=None, secure_train=False)[source]

Start a grpc server and listening the designated port.

fl_shutdown()[source]
get_current_model_meta_data()[source]

Get the model metadata, which usually contains additional fields.

overseer_callback(overseer_agent)[source]
remove_client_data(token)[source]
reset_tokens()[source]

Reset the token set.

After resetting, each client can take a token and start fetching the current global model. This function is not thread-safe.

run_engine()[source]
start_run(job_id, run_root, conf, args, snapshot)[source]
stop_training()[source]
property task_meta_info

Task meta information.

The model_meta_info uniquely defines the current model, it is used to reject outdated client’s update.