Logging functions¶
LoggingFunction base class¶
To develop custom loggers, we need to write a class that inherits from the base class LoggingFunction. Then, those custom loggers can be mapped to events of the user choice in the parameter mapping of the PyPads class.
-
class
pypads.functions.loggers.base_logger.
LoggingFunction
(*args, static_parameters=None, **kwargs)[source]¶ This class should be used to define new custom loggers. The user has to define __pre__ and/or __post__ methods depending on the specific use case.
Parameters: static_parameters – dict, optional, static parameters (if needed) to be used when logging. Note
It is not recommended to change the __call_wrapped__ method, only if really needed.
-
__call_wrapped__
(ctx, *args, _pypads_env: pypads.functions.analysis.call_tracker.LoggingEnv, _args, _kwargs, **_pypads_hook_params)[source]¶ The real call of the wrapped function. Be carefull when you change this. Exceptions here will not be catched automatically and might break your workflow. The returned value will be passed on to __post__ function.
Returns: _pypads_result
-
__post__
(ctx, *args, _pypads_env, _pypads_pre_return, _pypads_result, _args, _kwargs, **kwargs)[source]¶ The function to be called after executing the log anchor.
Parameters: - _pypads_pre_return – the value returned by __pre__.
- _pypads_result – the value returned by __call_wrapped__.
Returns: the wrapped function return value
-
Pre and Post run loggers¶
Another type of logging functions supported by Pypads is the pre/post run loggers which are executed before and after the run execution respectively.
- Pre Run loggers
-
class
pypads.functions.pre_run.pre_run.
PreRunFunction
(*args, fn=None, **kwargs)[source]¶ This class should be used to define new pre run functions
- Post Run loggers
-
class
pypads.functions.post_run.post_run.
PostRunFunction
(*args, fn=None, message=None, **kwargs)[source]¶ This class should be used to define new post run functions
Mlflow autolog (experimental)¶
Pypads also support mlflow autologging functionalities. More on that can be found at MLflow.
-
class
pypads.functions.loggers.mlflow.mlflow_autolog.
MlflowAutologger
(*args, order=-1, **kwargs)[source]¶ MlflowAutologger is the intergration of the mlflow autologging functionalities into PyPads tracking system.
-
__call_wrapped__
(ctx, *args, _args, _kwargs, _pypads_autologgers=None, _pypads_env=<class 'pypads.functions.analysis.call_tracker.LoggingEnv'>, **kwargs)[source]¶ Note
Experimental: This method may change or be removed in a future release without warning.
Function used to enable autologgers of mlflow.
-