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)[source]
authenticated_client(client_login, context) Client[source]

Use SSL certificate for authenticate the client.

Parameters
  • client_login – client login request

  • context – gRPC connection context

Returns

Client object.

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, context)[source]

Update the heartbeat of the client.

Parameters
  • token – client token

  • client_name – client name

  • context – grpc context

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(client_state, context, allow_new=False)[source]

Validate the client state message.

Parameters
  • client_state – A ClientState message received by server

  • context – gRPC connection context

  • 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