You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when a twin model is instantiated, it takes the global Pytwin log level. The twin runtime is instantiated with log_level=self._get_runtime_log_level().
It would be desirable to have the option to assign log levels on a per-instance basis. This is already possible at the core runtime level.
The current behaviour is problematic in the following case:
Certain twin models can produce extremely verbose logs at levels of INFO or higher, for example, containing detailed solver convergence logs for every time step. These messages quickly overwhelm any log messages from other parts of the code.
One workaround is to use a WARNING or lower log level, but then we lose INFO and DEBUG messages from other parts of the code.
Alternatively, we can use modify_pytwin_logging() to temporarily change the global log level to the desired level before instantiating the twin model e.g.
We could add an optional log_level argument to the TwinModel__init__() method. This can then be propagated down to _instantiate_twin_model() and use when instantiating TwinRuntime.
The default value for the argument could be set to retain the current behaviour.
📝 Description of the feature
Currently, when a twin model is instantiated, it takes the global Pytwin log level. The twin runtime is instantiated with
log_level=self._get_runtime_log_level()
.It would be desirable to have the option to assign log levels on a per-instance basis. This is already possible at the core runtime level.
The current behaviour is problematic in the following case:
Certain twin models can produce extremely verbose logs at levels of INFO or higher, for example, containing detailed solver convergence logs for every time step. These messages quickly overwhelm any log messages from other parts of the code.
One workaround is to use a WARNING or lower log level, but then we lose INFO and DEBUG messages from other parts of the code.
Alternatively, we can use
modify_pytwin_logging()
to temporarily change the global log level to the desired level before instantiating the twin model e.g.💡 Steps for implementing the feature
We could add an optional
log_level
argument to theTwinModel
__init__()
method. This can then be propagated down to_instantiate_twin_model()
and use when instantiatingTwinRuntime
.The default value for the argument could be set to retain the current behaviour.
Something along the lines of:
🔗 Useful links and references
No response
The text was updated successfully, but these errors were encountered: