perun.api.decorator¶
Decorator module.
Attributes¶
Functions¶
|
Decorate function to monitor its energy usage. |
|
Decorate function to monitor its energy usage. |
|
Register a function to run after perun has finished collection data. |
|
Register a function that initializes a live callback function that will be run after each datapoint is collected on the monitoring subprocess. |
Module Contents¶
- perun.api.decorator.monitor(region_name: str | None = None) Callable[source]¶
Decorate function to monitor its energy usage.
- perun.api.decorator.perun(configuration_file: str = './.perun.ini', **conf_kwargs: Any) Callable[source]¶
Decorate function to monitor its energy usage.
- perun.api.decorator.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.api.decorator.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.