def get_debugger_exception_classes()

in src/sagemaker_training/process.py [0:0]


def get_debugger_exception_classes():
    """Set exception classes"""
    exception_classes = []
    if os.environ.get("USE_SMDEBUG") == "0":
        logger.info("Sagemaker Debugger is not enabled, debugger exceptions will not be imported.")
    else:
        try:
            from smdebug import exceptions

            # list of exceptions debugger wants training toolkit to catch and log
            exception_classes += [ex for ex in dir(exceptions) if isclass(getattr(exceptions, ex))]
        except ImportError:
            logger.info("Exceptions not imported for SageMaker Debugger as it is not installed.")

    if not exception_classes:
        exception_classes = [DEFAULT_ERROR_CLASS]
    return exception_classes