diff --git a/clearml/backend_interface/base.py b/clearml/backend_interface/base.py index bf7fbfd8..2928045a 100644 --- a/clearml/backend_interface/base.py +++ b/clearml/backend_interface/base.py @@ -2,6 +2,7 @@ import abc import requests.exceptions import six +import jsonschema from ..backend_api import Session, CallResult from ..backend_api.session.session import MaxRequestSizeError @@ -15,6 +16,10 @@ from ..debugging import get_logger from .session import SendError, SessionInterface +class ValidationError(ValueError): + pass + + class InterfaceBase(SessionInterface): """ Base class for a backend manager class """ _default_session = None @@ -78,6 +83,15 @@ class InterfaceBase(SessionInterface): if raise_on_errors: raise res = None + except jsonschema.ValidationError as e: + if log: + log.error( + 'Field %s contains illegal schema: %s', '.'.join(e.path), str(e.message) + ) + if raise_on_errors: + raise ValidationError(f"Field {'.'.join(e.path)} contains illegal schema: {e.message}") + # We do not want to retry + return None except Exception as e: res = None if log and num_retries >= cls._num_retry_warning_display: