perun.api.decorator =================== .. py:module:: perun.api.decorator .. autoapi-nested-parse:: Decorator module. Attributes ---------- .. autoapisummary:: perun.api.decorator.log Functions --------- .. autoapisummary:: perun.api.decorator.monitor perun.api.decorator.perun perun.api.decorator.register_callback perun.api.decorator.register_live_callback Module Contents --------------- .. py:data:: log .. py:function:: monitor(region_name: str | None = None) -> Callable Decorate function to monitor its energy usage. .. py:function:: perun(configuration_file: str = './.perun.ini', **conf_kwargs: Any) -> Callable Decorate function to monitor its energy usage. .. py:function:: register_callback(func: Callable[[perun.data_model.data.DataNode], None]) -> None Register a function to run after perun has finished collection data. :param func: Function to be called. :type func: Callable[[DataNode], None] .. py:function:: register_live_callback(obj: Callable[[], Callable[[dict[str, perun.processing.Number]], None]], id: str) -> None 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. :param obj: 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. :type obj: Callable[[], Callable[[str, Union[int, float]], None]] :param id: Identifier for the live callback, used to register it in the Perun instance. :type id: str