p2pfl.management.logger.logger moduleΒΆ
P2PFL Logger.
Note
Not all is typed because the python logger is not typed (yep, is a TODOβ¦).
- class p2pfl.management.logger.logger.ColoredFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)[source]ΒΆ
Bases:
Formatter
Formatter that adds color to the log messages.
- exception p2pfl.management.logger.logger.NodeNotRegistered[source]ΒΆ
Bases:
Exception
Exception raised when a node is not registered.
- class p2pfl.management.logger.logger.P2PFLogger(nodes=None, disable_locks=False)[source]ΒΆ
Bases:
object
Class that manages the node logging (not a singleton).
- Parameters:
p2pfl_web_services β The P2PFL Web Services to log and monitor the nodes remotely.
- add_handler(handler)[source]ΒΆ
Add a handler to the logger.
- Parameters:
handler (
Handler
) β The logger handler.- Return type:
None
- connect_web(url, key)[source]ΒΆ
Connect to the web services.
- Parameters:
url (
str
) β The URL of the web services.key (
str
) β The API key.
- Return type:
None
- critical(node, message, *, _ray_trace_ctx=None)[source]ΒΆ
Log a critical message.
- Parameters:
node (
str
) β The node name.message (
str
) β The message to log.
- Return type:
None
- debug(node, message, *, _ray_trace_ctx=None)[source]ΒΆ
Log a debug message.
- Parameters:
node (
str
) β The node name.message (
str
) β The message to log.
- Return type:
None
- error(node, message, *, _ray_trace_ctx=None)[source]ΒΆ
Log an error message.
- Parameters:
node (
str
) β The node name.message (
str
) β The message to log.
- Return type:
None
- experiment_finished(node)[source]ΒΆ
Notify the experiment end.
- Parameters:
node (
str
) β The node address.- Return type:
None
- experiment_started(node, experiment)[source]ΒΆ
Notify the experiment start.
- Parameters:
node (
str
) β The node address.experiment (
Experiment
|None
) β The experiment.
- Return type:
None
- get_global_logs()[source]ΒΆ
Get the logs.
- Parameters:
node β The node name.
exp β The experiment name.
- Return type:
Dict
[str
,Dict
[str
,Dict
[str
,List
[Tuple
[int
,float
]]]]]- Returns:
The logs.
- get_level_name(lvl)[source]ΒΆ
Get the logger level name.
- Parameters:
lvl (
int
) β The logger level.- Return type:
str
- Returns:
The logger level name.
- get_local_logs()[source]ΒΆ
Get the logs.
- Parameters:
node β The node name.
exp β The experiment name.
- Return type:
Dict
[str
,Dict
[int
,Dict
[str
,Dict
[str
,List
[Tuple
[int
,float
]]]]]]- Returns:
The logs.
- get_nodes()[source]ΒΆ
Get the registered nodes.
- Return type:
Dict
[str
,Dict
[Any
,Any
]]- Returns:
The registered nodes.
- info(node, message, *, _ray_trace_ctx=None)[source]ΒΆ
Log an info message.
- Parameters:
node (
str
) β The node name.message (
str
) β The message to log.
- Return type:
None
- log(level, node, message)[source]ΒΆ
Log a message.
- Parameters:
level (
int
) β The log level.node (
str
) β The node name.message (
str
) β The message to log.
- Return type:
None
- log_metric(addr, metric, value, round=None, step=None)[source]ΒΆ
Log a metric.
- Parameters:
addr (
str
) β The node name.metric (
str
) β The metric to log.value (
float
) β The value.step (
Optional
[int
]) β The step.round (
Optional
[int
]) β The round.
- Return type:
None
- log_system_metric(node, metric, value, time)[source]ΒΆ
Log a system metric.
- Parameters:
node (
str
) β The node name.metric (
str
) β The metric to log.value (
float
) β The value.time (
datetime
) β The time.
- Return type:
None
- register_node(node, simulation)[source]ΒΆ
Register a node.
- Parameters:
node (
str
) β The node address.simulation (
bool
) β If the node is a simulation.
- Return type:
None
- round_finished(node)[source]ΒΆ
Notify the round end.
- Parameters:
node (
str
) β The node address.- Return type:
None
- round_started(node, experiment)[source]ΒΆ
Notify the round start.
- Parameters:
node (
str
) β The node address.experiment (
Experiment
|None
) β The experiment.
- Return type:
None
- set_level(level)[source]ΒΆ
Set the logger level.
- Parameters:
level (
Union
[int
,str
]) β The logger level.- Return type:
None