p2pfl.node_state module¶
Node state.
- class p2pfl.node_state.NodeState(addr, simulation=False)[source]¶
Bases:
object
Class to store the main state of a learning node.
- addr¶
The address of the node.
- Type:
str
- status¶
The status of the node.
- Type:
str
- simulation¶
If the node is a simulation.
- Type:
bool
- models_aggregated¶
The models aggregated by the node.
- Type:
Dict[str, List[str]]
- nei_status¶
The status of the neighbors.
- Type:
Dict[str, int]
- train_set¶
The train set of the node.
- Type:
List[str]
- train_set_votes¶
The votes of the train set.
- Type:
Dict[str, Dict[str, int]]
- train_set_votes_lock¶
The lock for the train set votes.
- Type:
threading.Lock
- start_thread_lock¶
The lock for the start thread.
- Type:
threading.Lock
- wait_votes_ready_lock¶
The lock for the wait votes ready.
- Type:
threading.Lock
- model_initialized_lock¶
The lock for the model initialized.
- Type:
threading.Lock
- Parameters:
addr (
str
) – The address of the node.
- property exp_name: str | None¶
Get the actual experiment name.
- increase_round()[source]¶
Increase the round number.
- Raises:
ValueError – If the experiment is not initialized.
- Return type:
None
- property round: int | None¶
Get the round.
- set_experiment(exp_name, total_rounds)[source]¶
Start a new experiment.
- exp_name¶
The name of the experiment.
- total_rounds¶
The total rounds of the experiment.
- Return type:
None
- property total_rounds: int | None¶
Get the total rounds.