ClientManager¶

class ClientManager[source]¶

Bases: ABC

Abstract base class for managing Flower clients.

Methods

all()

Return all available clients.

num_available()

Return the number of available clients.

register(client)

Register Flower ClientProxy instance.

sample(num_clients[, min_num_clients, criterion])

Sample a number of Flower ClientProxy instances.

unregister(client)

Unregister Flower ClientProxy instance.

wait_for(num_clients, timeout)

Wait until at least num_clients are available.

abstract all() dict[str, ClientProxy][source]¶

Return all available clients.

abstract num_available() int[source]¶

Return the number of available clients.

Returns:

num_available – The number of currently available clients.

Return type:

int

abstract register(client: ClientProxy) bool[source]¶

Register Flower ClientProxy instance.

Parameters:

client (flwr.server.client_proxy.ClientProxy) – The ClientProxy of the Client to register.

Returns:

success – Indicating if registration was successful. False if ClientProxy is already registered or can not be registered for any reason.

Return type:

bool

abstract sample(num_clients: int, min_num_clients: int | None = None, criterion: Criterion | None = None) list[ClientProxy][source]¶

Sample a number of Flower ClientProxy instances.

abstract unregister(client: ClientProxy) None[source]¶

Unregister Flower ClientProxy instance.

This method is idempotent.

Parameters:

client (flwr.server.client_proxy.ClientProxy) – The ClientProxy of the Client to unregister.

abstract wait_for(num_clients: int, timeout: int) bool[source]¶

Wait until at least num_clients are available.