Skip to content

Exceptions

zenml.exceptions

ZenML specific exception definitions

AlreadyExistsException (ZenMLBaseException)

Raises exception when the name already exist in the system but an action is trying to create a resource with the same name.

Source code in zenml/exceptions.py
class AlreadyExistsException(ZenMLBaseException):
    """Raises exception when the `name` already exist in the system but an
    action is trying to create a resource with the same name."""

    def __init__(
        self,
        message: Optional[str] = None,
        name: str = "",
        resource_type: str = "",
    ):
        if message is None:
            message = f"{resource_type} `{name}` already exists!"
        super().__init__(message)

ArtifactInterfaceError (ZenMLBaseException)

Raises exception when interacting with the Artifact interface in an unsupported way.

Source code in zenml/exceptions.py
class ArtifactInterfaceError(ZenMLBaseException):
    """Raises exception when interacting with the Artifact interface
    in an unsupported way."""

ArtifactStoreInterfaceError (ZenMLBaseException)

Raises exception when interacting with the Artifact Store interface in an unsupported way.

Source code in zenml/exceptions.py
class ArtifactStoreInterfaceError(ZenMLBaseException):
    """Raises exception when interacting with the Artifact Store interface
    in an unsupported way."""

DoesNotExistException (ZenMLBaseException)

Raises exception when the entity does not exist in the system but an action is being done that requires it to be present.

Source code in zenml/exceptions.py
class DoesNotExistException(ZenMLBaseException):
    """Raises exception when the entity does not exist in the system but an
    action is being done that requires it to be present."""

    def __init__(self, message: str):
        super().__init__(message)

DuplicateRunNameError (RuntimeError)

Raises exception when a run with the same name already exists.

Source code in zenml/exceptions.py
class DuplicateRunNameError(RuntimeError):
    """Raises exception when a run with the same name already exists."""

    def __init__(
        self,
        message: str = "Unable to run a pipeline with a run name that "
        "already exists.",
    ):
        super().__init__(message)

EntityExistsError (ZenMLBaseException)

Raised when trying to register a user-management entity with a name that already exists.

Source code in zenml/exceptions.py
class EntityExistsError(ZenMLBaseException):
    """Raised when trying to register a user-management entity with a name that
    already exists."""

ForbiddenRepositoryAccessError (ZenMLBaseException, RuntimeError)

Raised when trying to access a ZenML repository instance while a step is executed.

Source code in zenml/exceptions.py
class ForbiddenRepositoryAccessError(ZenMLBaseException, RuntimeError):
    """Raised when trying to access a ZenML repository instance while a step
    is executed."""

GitException (ZenMLBaseException)

Raises exception when a problem occurs in git resolution.

Source code in zenml/exceptions.py
class GitException(ZenMLBaseException):
    """Raises exception when a problem occurs in git resolution."""

    def __init__(
        self,
        message: str = "There is a problem with git resolution. "
        "Please make sure that all relevant files "
        "are committed.",
    ):
        super().__init__(message)

GitNotFoundError (ImportError)

Raised when ZenML CLI is used to interact with examples on a machine with no git installation

Source code in zenml/exceptions.py
class GitNotFoundError(ImportError):
    """Raised when ZenML CLI is used to interact with examples on a machine
    with no git installation"""

InitializationException (ZenMLBaseException)

Raised when an error occurred during initialization of a ZenML repository.

Source code in zenml/exceptions.py
class InitializationException(ZenMLBaseException):
    """Raised when an error occurred during initialization of a ZenML
    repository."""

IntegrationError (ZenMLBaseException)

Raises exceptions when a requested integration can not be activated.

Source code in zenml/exceptions.py
class IntegrationError(ZenMLBaseException):
    """Raises exceptions when a requested integration can not be activated."""

MaterializerInterfaceError (ZenMLBaseException)

Raises exception when interacting with the Materializer interface in an unsupported way.

Source code in zenml/exceptions.py
class MaterializerInterfaceError(ZenMLBaseException):
    """Raises exception when interacting with the Materializer interface
    in an unsupported way."""

MissingStepParameterError (ZenMLBaseException)

Raises exceptions when a step parameter is missing when running a pipeline.

Source code in zenml/exceptions.py
class MissingStepParameterError(ZenMLBaseException):
    """Raises exceptions when a step parameter is missing when running a
    pipeline."""

    def __init__(
        self,
        step_name: str,
        missing_parameters: List[str],
        config_class: Type["BaseStepConfig"],
    ):
        """
        Initializes a MissingStepParameterError object.

        Args:
            step_name: Name of the step for which one or more parameters
                       are missing.
            missing_parameters: Names of all parameters which are missing.
            config_class: Class of the configuration object for which
                          the parameters are missing.
        """
        message = textwrap.fill(
            textwrap.dedent(
                f"""
            Missing parameters {missing_parameters} for '{step_name}' step.
            There are three ways to solve this issue:
            (1) Specify a default value in the configuration class
            `{config_class.__name__}`
            (2) Specify the parameters in code when creating the pipeline:
            `my_pipeline({step_name}(config={config_class.__name__}(...))`
            (3) Specify the parameters in a yaml configuration file and pass
            it to the pipeline: `my_pipeline(...).with_config('path_to_yaml')`
            """
            )
        )
        super().__init__(message)

__init__(self, step_name, missing_parameters, config_class) special

Initializes a MissingStepParameterError object.

Parameters:

Name Type Description Default
step_name str

Name of the step for which one or more parameters are missing.

required
missing_parameters List[str]

Names of all parameters which are missing.

required
config_class Type[BaseStepConfig]

Class of the configuration object for which the parameters are missing.

required
Source code in zenml/exceptions.py
def __init__(
    self,
    step_name: str,
    missing_parameters: List[str],
    config_class: Type["BaseStepConfig"],
):
    """
    Initializes a MissingStepParameterError object.

    Args:
        step_name: Name of the step for which one or more parameters
                   are missing.
        missing_parameters: Names of all parameters which are missing.
        config_class: Class of the configuration object for which
                      the parameters are missing.
    """
    message = textwrap.fill(
        textwrap.dedent(
            f"""
        Missing parameters {missing_parameters} for '{step_name}' step.
        There are three ways to solve this issue:
        (1) Specify a default value in the configuration class
        `{config_class.__name__}`
        (2) Specify the parameters in code when creating the pipeline:
        `my_pipeline({step_name}(config={config_class.__name__}(...))`
        (3) Specify the parameters in a yaml configuration file and pass
        it to the pipeline: `my_pipeline(...).with_config('path_to_yaml')`
        """
        )
    )
    super().__init__(message)

PipelineConfigurationError (ZenMLBaseException)

Raises exceptions when a pipeline configuration contains invalid values.

Source code in zenml/exceptions.py
class PipelineConfigurationError(ZenMLBaseException):
    """Raises exceptions when a pipeline configuration contains
    invalid values."""

PipelineInterfaceError (ZenMLBaseException)

Raises exception when interacting with the Pipeline interface in an unsupported way.

Source code in zenml/exceptions.py
class PipelineInterfaceError(ZenMLBaseException):
    """Raises exception when interacting with the Pipeline interface
    in an unsupported way."""

PipelineNotSucceededException (ZenMLBaseException)

Raises exception when trying to fetch artifacts from a not succeeded pipeline.

Source code in zenml/exceptions.py
class PipelineNotSucceededException(ZenMLBaseException):
    """Raises exception when trying to fetch artifacts from a not succeeded
    pipeline."""

    def __init__(
        self,
        name: str = "",
        message: str = "{} is not yet completed successfully.",
    ):
        super().__init__(message.format(name))

ProvisioningError (ZenMLBaseException)

Raised when an error occurs when provisioning resources for a StackComponent.

Source code in zenml/exceptions.py
class ProvisioningError(ZenMLBaseException):
    """Raised when an error occurs when provisioning resources for a
    StackComponent."""

StackComponentExistsError (ZenMLBaseException)

Raised when trying to register a stack component with a name that already exists.

Source code in zenml/exceptions.py
class StackComponentExistsError(ZenMLBaseException):
    """Raised when trying to register a stack component with a name that
    already exists."""

StackComponentInterfaceError (ZenMLBaseException)

Raises exception when interacting with the stack components in an unsupported way.

Source code in zenml/exceptions.py
class StackComponentInterfaceError(ZenMLBaseException):
    """Raises exception when interacting with the stack components
    in an unsupported way."""

StackExistsError (ZenMLBaseException)

Raised when trying to register a stack with a name that already exists.

Source code in zenml/exceptions.py
class StackExistsError(ZenMLBaseException):
    """Raised when trying to register a stack with a name that already
    exists."""

StackValidationError (ZenMLBaseException)

Raised when a stack configuration is not valid.

Source code in zenml/exceptions.py
class StackValidationError(ZenMLBaseException):
    """Raised when a stack configuration is not valid."""

StepContextError (ZenMLBaseException)

Raises exception when interacting with a StepContext in an unsupported way.

Source code in zenml/exceptions.py
class StepContextError(ZenMLBaseException):
    """Raises exception when interacting with a StepContext
    in an unsupported way."""

StepInterfaceError (ZenMLBaseException)

Raises exception when interacting with the Step interface in an unsupported way.

Source code in zenml/exceptions.py
class StepInterfaceError(ZenMLBaseException):
    """Raises exception when interacting with the Step interface
    in an unsupported way."""

ZenMLBaseException (Exception)

Base exception for all ZenML Exceptions.

Source code in zenml/exceptions.py
class ZenMLBaseException(Exception):
    """Base exception for all ZenML Exceptions."""

    def __init__(
        self,
        message: Optional[str] = None,
        url: Optional[str] = None,
    ):
        """BaseException used to format messages displayed to the user.

        Args:
            message: Message with details of exception. This message
                     will be appended with another message directing user to
                     `url` for more information. If `None`, then default
                     Exception behavior is used.
            url: URL to point to in exception message. If `None`, then no url
                 is appended.
        """
        if message:
            if url:
                message += f" For more information, visit {url}."
        super().__init__(message)

__init__(self, message=None, url=None) special

BaseException used to format messages displayed to the user.

Parameters:

Name Type Description Default
message Optional[str]

Message with details of exception. This message will be appended with another message directing user to url for more information. If None, then default Exception behavior is used.

None
url Optional[str]

URL to point to in exception message. If None, then no url is appended.

None
Source code in zenml/exceptions.py
def __init__(
    self,
    message: Optional[str] = None,
    url: Optional[str] = None,
):
    """BaseException used to format messages displayed to the user.

    Args:
        message: Message with details of exception. This message
                 will be appended with another message directing user to
                 `url` for more information. If `None`, then default
                 Exception behavior is used.
        url: URL to point to in exception message. If `None`, then no url
             is appended.
    """
    if message:
        if url:
            message += f" For more information, visit {url}."
    super().__init__(message)