5.1.1.6.1.3. FedEval.role.container

5.1.1.6.1.3.1. Module Contents

5.1.1.6.1.3.1.1. Classes

ClientContext

ClientContextManager

ClientNodeContext

ClientNodeContextManager

5.1.1.6.1.3.1.2. Attributes

ContainerId

CommunicationId

NodeId

FedEval.role.container.ContainerId
class FedEval.role.container.ClientContext(client_id: FedEval.config.ClientId, fed_strategy: type, temp_dir_path: str)
property host_params_round: int
property local_train_round: int
property id: FedEval.config.ClientId
property strategy: FedEval.strategy.FedStrategyInterface
property awake: bool
property sleeping: bool
step_forward_host_params_round() int
step_forward_local_train_round() int
sleep() None
static _save(strategy, path: str) None
wake_up() None
class FedEval.role.container.ClientContextManager(id: ContainerId | str, tmp_dir_path: str)
property container_id: ContainerId
property client_ids: Iterable[FedEval.config.ClientId]
_allocate_client_ids() Sequence[FedEval.config.ClientId]

allocate cid for the clients hold by this container and initiate round counters.

client_cids allocation examples: # case 0: Given: container_num: 2, client_num: 13 Thus: num_clients_in_each_container -> 6 num_clients % num_containers -> 1 ## container_0 client_cids: [0..=6] ## container_1 client_cids: [7..=12]

# case 1: Given: container_num: 3, client_num: 13 Thus: num_clients_in_each_container -> 4 num_clients % num_containers -> 1 ## container_0 client_cids: [0..=4] ## container_1 client_cids: [5..=8] ## container_2 client_cids: [9..=12]

set_logger(logger)
get(client_id: FedEval.config.ClientId) ClientContext
FedEval.role.container.CommunicationId
FedEval.role.container.NodeId
class FedEval.role.container.ClientNodeContext(id: NodeId, comm_id: CommunicationId, client_ids: Iterable[FedEval.config.ClientId])
property id: NodeId
property comm_id: CommunicationId
property client_ids: Iterable[FedEval.config.ClientId]
class FedEval.role.container.ClientNodeContextManager
property online_client_ids: Iterable[FedEval.config.ClientId]
activate(node_id: NodeId, comm_id: CommunicationId, client_ids: Iterable[FedEval.config.ClientId])
recover_from_deactivation(node_id: NodeId)
deactivate_by_node_id(node_id: NodeId) Iterable[FedEval.config.ClientId]

mark the given node as offline and return the corresponding offline clients.

Parameters:

node_id (NodeId) – the id of the offline node

Returns:

the client on the given offline node.

Return type:

Iterable[ClientId]

deactivate_by_comm(comm_id: CommunicationId) Iterable[FedEval.config.ClientId]
get_by_node(node_id: NodeId) ClientNodeContext
get_by_client(client_id: FedEval.config.ClientId) ClientNodeContext
get_by_comm(comm_id: CommunicationId) ClientNodeContext
cluster_by_node(selected_clients: Iterable[FedEval.config.ClientId]) Mapping[NodeId, Iterable[FedEval.config.ClientId]]