p2pfl.management.metric_storage moduleΒΆ

Metric storage.

class p2pfl.management.metric_storage.GlobalMetricStorage(disable_locks=False)[source]ΒΆ

Bases: object

Global metric storage. It stores the metrics for each node in each experiment.

Format:

{
    "experiment":{
        "node_name": {
            "metric": [(round, value), ...]
    }
}
add_log(exp_name, round, metric, node, val)[source]ΒΆ

Add a log entry.

Parameters:
  • exp_name (str) – Experiment name.

  • round (int) – Round number.

  • metric (str) – Metric name.

  • node (str) – Node name.

  • val (Union[int, float]) – Value of the metric.

Return type:

None

get_all_logs()[source]ΒΆ

Obtain all logs.

Return type:

Dict[str, Dict[str, Dict[str, List[Tuple[int, float]]]]]

Returns:

All logs

get_experiment_logs(exp)[source]ΒΆ

Obtain logs for an experiment.

Parameters:

exp (str) – Experiment number

Return type:

Dict[str, Dict[str, List[Tuple[int, float]]]]

Returns:

Experiment logs

get_experiment_node_logs(exp, node)[source]ΒΆ

Obtain logs for a node in an experiment.

Parameters:
  • exp (str) – Experiment number

  • node (str) – Node name

Return type:

Dict[str, List[Tuple[int, float]]]

Returns:

Node logs

class p2pfl.management.metric_storage.LocalMetricStorage(disable_locks=False)[source]ΒΆ

Bases: object

Local metric storage. It stores the metrics for each node in each round of each experiment.

Format:

{
    "experiment": {
        "round": {
            "node_name": {
                "metric": [(step, value), ...]
            }
        }
    }
}
add_log(exp_name, round, metric, node, val, step)[source]ΒΆ

Add a log entry.

Parameters:
  • exp_name (str) – Experiment name.

  • round (int) – Round number.

  • metric (str) – Metric name.

  • node (str) – Node name.

  • val (Union[int, float]) – Value of the metric.

  • step (int) – Step number.

Return type:

None

get_all_logs()[source]ΒΆ

Obtain all logs.

Return type:

Dict[str, Dict[int, Dict[str, Dict[str, List[Tuple[int, float]]]]]]

Returns:

All logs

get_experiment_logs(exp)[source]ΒΆ

Obtain logs for an experiment.

Parameters:

exp (str) – Experiment number

Return type:

Dict[int, Dict[str, Dict[str, List[Tuple[int, float]]]]]

Returns:

Experiment logs

get_experiment_round_logs(exp, round)[source]ΒΆ

Obtain logs for a round in an experiment.

Parameters:
  • exp (str) – Experiment number

  • round (int) – Round number

Return type:

Dict[str, Dict[str, List[Tuple[int, float]]]]

Returns:

Round logs

get_experiment_round_node_logs(exp, round, node)[source]ΒΆ

Obtain logs for a node in an experiment.

Parameters:
  • exp (str) – Experiment number

  • round (int) – Round number

  • node (str) – Node name

Return type:

Dict[str, List[Tuple[int, float]]]

Returns:

Node logs