perun

perun module.

Submodules

Functions

monitor(→ Callable)

Decorate function to monitor its energy usage.

perun(→ Callable)

Decorate function to monitor its energy usage.

register_callback(→ None)

Register a function to run after perun has finished collection data.

register_live_callback(→ None)

Register a function that initializes a live callback function that will be run after each datapoint is collected on the monitoring subprocess.

Package Contents

perun.monitor(region_name: str | None = None) Callable[source]

Decorate function to monitor its energy usage.

perun.perun(configuration_file: str = './.perun.ini', **conf_kwargs: Any) Callable[source]

Decorate function to monitor its energy usage.

perun.register_callback(func: Callable[[perun.data_model.data.DataNode], None]) None[source]

Register a function to run after perun has finished collection data.

Parameters:

func (Callable[[DataNode], None]) – Function to be called.

perun.register_live_callback(obj: Callable[[], Callable[[dict[str, perun.processing.Number]], None]], id: str) None[source]

Register a function that initializes a live callback function that will be run after each datapoint is collected on the monitoring subprocess.

This is useful for live monitoring of metrics in real-time.

The function passed should return a callable that accepts the metric identifier and the metric value.

This structure is for systems that need to establish a connection to an external server, like MLFlow and Weights and Biases, as such objects are not serializable and can sometimes cause issues with the multiprocessing module.

Parameters:
  • obj (Callable[[], Callable[[str, Union[int, float]], None]]) – Function that initializes the live callback. It should return a callable that accepts the metric identifier and the metric value. It should take no arguments.

  • id (str) – Identifier for the live callback, used to register it in the Perun instance.