fedn.network.controller package

The controller package is responsible for orchestrating the federated learning process. It’s acts as a gRPC client and sends round config tasks to the fedn.network.combiner.Combiner.

Submodules

fedn.network.controller.control module

exception fedn.network.controller.control.CombinersNotDoneException(message)[source]

Bases: Exception

Exception class for when model is None

__init__(message)[source]

Constructor method.

Parameters:

message (str) – The exception message.

class fedn.network.controller.control.Control(network_id: str, repository: Repository, db: DatabaseConnection)[source]

Bases: ControlBase

Controller, implementing the overall global training, validation and prediction logic.

Parameters:

statestore (class: fedn.network.statestorebase.StateStorageBase) – A StateStorage instance.

__init__(network_id: str, repository: Repository, db: DatabaseConnection)[source]

Constructor method.

classmethod create_instance(network_id: str, repository: Repository, db: DatabaseConnection) Control[source]

Create a singleton instance of the Control class.

Parameters:
Returns:

The Control instance.

Return type:

Control

classmethod instance() Control[source]

Get the singleton instance of the Control class.

predict_instruct(config)[source]

Main entrypoint for executing the prediction compute plan.

: param config: configuration for the prediction round

prediction_round(config)[source]

Execute a prediction round.

: param config: configuration for the prediction round

prediction_session(config: RoundConfig) None[source]

Execute a new prediction session.

Parameters:

config (PredictionConfig) – The round config.

Returns:

None

reduce(combiners)[source]

Combine updated models from Combiner nodes into one global model.

: param combiners: dict of combiner names(key) and model IDs(value) to reduce : type combiners: dict

round(session_config: SessionConfigDTO, round_id: str, session_id: str, model_name: str | None = None, client_ids: list[str] | None = None) tuple[source]

Execute one global round.

: param session_config: The session config. : type session_config: dict : param round_id: The round id. : type round_id: str

splitlearning_round(session_config: SessionConfigDTO, round_id: str, session_id: str)[source]

Execute one global split learning round

Parameters:
  • session_config (SessionConfigDTO) – The session config

  • round_id (str) – The round id

  • session_id (str) – The session id

splitlearning_session(session_id: str, rounds: int, round_timeout: int) None[source]

Execute a split learning session.

Parameters:
  • session_id (str) – The session id.

  • rounds (int) – The number of rounds.

  • round_timeout (int) – The round timeout.

start_session(session_id: str, rounds: int, round_timeout: int, model_name_prefix: str | None = None, client_ids: list[str] | None = None) None[source]
exception fedn.network.controller.control.MisconfiguredStorageBackend(message)[source]

Bases: Exception

Exception class for when storage backend is misconfigured.

Parameters:

message (str) – The exception message.

__init__(message)[source]

Constructor method.

exception fedn.network.controller.control.NoModelException(message)[source]

Bases: Exception

Exception class for when model is None

Parameters:

message (str) – The exception message.

__init__(message)[source]

Constructor method.

exception fedn.network.controller.control.SessionTerminatedException(message)[source]

Bases: Exception

Exception class for when session is terminated

__init__(message)[source]

Constructor method.

Parameters:

message (str) – The exception message.

exception fedn.network.controller.control.UnsupportedStorageBackend(message)[source]

Bases: Exception

Exception class for when storage backend is not supported. Passes

__init__(message)[source]

Constructor method.

Parameters:

message (str) – The exception message.