def get_dataparallel_exception_classes()

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


def get_dataparallel_exception_classes():
    """Get ddp exception classes"""
    exception_classes = []
    try:
        from smdistributed.dataparallel import exceptions

        # list of exceptions SMDDP wants training toolkit to catch and log
        exception_classes += [ex for ex in dir(exceptions) if isclass(getattr(exceptions, ex))]
    # relaxed exception type in case of custom exceptions thrown during import
    except Exception:  # pylint: disable=broad-except
        logger.info(
            "smdistributed.dataparallel not found or "
            "using an older version without custom exceptions."
            "SM training toolkit will track user script error only"
        )
    if not exception_classes:
        exception_classes = [DEFAULT_ERROR_CLASS]
    return exception_classes