fedn.network.clients package
The FEDn client package is responsible for executing the federated learning tasks, including ML model training and validation. It’s the acting gRPC client for the federated network.
The client first connacts the centralized controller to receive fedn.network.combiner.Combiner
assingment. The client then connects to the combiner and
sends requests to the combiner to receive model updates and send model updates.
Submodules
fedn.network.clients.client module
fedn.network.clients.connect module
- class fedn.network.clients.connect.ConnectorClient(host, port, token, name, remote_package, force_ssl=False, verify=False, combiner=None, id=None)[source]
Bases:
object
Connector for assigning client to a combiner in the FEDn network.
- Parameters:
host (str) – host of discovery service
port (int) – port of discovery service
token (str) – token for authentication
name (str) – name of client
remote_package (bool) – True if remote package is used, False if local
force_ssl (bool) – True if https is used, False if http
verify (bool) – True if certificate is verified, False if not
combiner (str) – name of preferred combiner
id – id of client
- assign()[source]
Connect client to FEDn network discovery service, ask for combiner assignment.
- Returns:
Tuple with assingment status, combiner connection information if sucessful, else None.
- Return type:
tuple(
fedn.network.clients.connect.Status
, str)
- refresh_token()[source]
Refresh client token.
- Returns:
Tuple with assingment status, combiner connection information if sucessful, else None.
- Return type:
tuple(
fedn.network.clients.connect.Status
, str)
fedn.network.clients.package module
fedn.network.clients.state module
- class fedn.network.clients.state.ClientState(value)[source]
Bases:
Enum
Enum for representing the state of a client.
- idle = 1
- predicting = 4
- training = 2
- validating = 3
- fedn.network.clients.state.ClientStateToString(state)[source]
Convert a ClientState to a string representation.
- Parameters:
state (
fedn.network.clients.state.ClientState
) – the state to convert- Returns:
string representation of the state
- Return type: