schrodinger.infra.exception_handler module¶
A top level Python exception handler that prevents uncaught exceptions in Python scripts from crashing Maestro.
To activate the exception handler use
exception_handler.set_exception_handler()
. That will activate the
appropriate exception handler.
If SCHRODINGER_DEV_DEBUG or SCHRODINGER_SRC are defined, we install a handler that simply prints tracebacks to the terminal. Otherwise (generally on customer machines), we install a handler that writes uncaught exceptions to a folder in .schrodinger. The user is informed of the error and told to contact customer service.
-
class
schrodinger.infra.exception_handler.
ExceptionRecorder
[source]¶ Bases:
object
A top level exception handler that writes uncaught exceptions to a folder in .schrodinger. The user is informed of the error and told to contact customer service.
This handler can be activated by
sys.excepthook = ExceptionRecorder()
or by calling theenable_handler()
convenience function.- Variables
_OPENFLAGS (int) – The flags used when opening a file. These flags are set to ensure that files are opened in a thread-safe manner.
_EXCEPTIONS_DIR (str) – The directory where exceptions are stored
_MAX_EXCEP_FILES (int) – The maximum number of files allowed in the exceptions directory. Once this number of files is hit, the oldest files will be erased after recording the next exception.