nvflare.private.fed.server.client_manager module

class ClientManager(project_name=None, min_num_clients=2, max_num_clients=10)[source]

Bases: object

Manages client adding and removing.

Parameters:
  • project_name – project name

  • min_num_clients – minimum number of clients allowed.

  • max_num_clients – maximum number of clients allowed.

authenticate(request, context) Client | None[source]
authenticated_client(request, context) Client | None[source]

Use SSL certificate for authenticate the client.

Parameters:
  • request – client login request Message

  • context – FL_Context

Returns:

Client object.

get_all_clients_from_inputs(inputs)[source]
get_client_from_name(client_name)[source]
get_clients()[source]

Get the list of registered clients.

Returns:

client}

Return type:

A dict of {client_token

get_max_clients()[source]
get_min_clients()[source]
heartbeat(token, client_name, fl_ctx)[source]

Update the heartbeat of the client.

Parameters:
  • token – client token

  • client_name – client name

  • fl_ctx – FLContext

Returns:

If a new client needs to be created.

is_from_authorized_client(token)[source]

Check if a client is authorized.

Parameters:

token – client token

Returns:

True if it is a recognised client

is_valid_task(task)[source]

Check whether the requested task matches the server’s project_name.

Returns:

True if task name is the same as server’s project name.

login_client(client_login, context)[source]
remove_client(token)[source]

Remove a registered client.

Parameters:

token – client token

Returns:

The removed Client object

validate_client(request, fl_ctx: FLContext, allow_new=False)[source]

Validate the client state message.

Parameters:
  • request – A request from client.

  • fl_ctx – FLContext

  • allow_new – whether to allow new client. Note that its task should still match server’s.

Returns:

client id if it’s a valid client