Skip to content

Exceptions

zenml.exceptions

ZenML specific exception definitions

AlreadyExistsException (Exception)

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(Exception):
    """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 (Exception)

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

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

DoesNotExistException (Exception)

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(Exception):
    """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)

EmptyDatasourceException (Exception)

Raises exception when a datasource data is accessed without running an associated pipeline.

Source code in zenml/exceptions.py
class EmptyDatasourceException(Exception):
    """Raises exception when a datasource data is accessed without running
    an associated pipeline."""

    def __init__(
        self,
        message: str = "This datasource has not been used in "
        "any pipelines, therefore the associated data has no "
        "versions. Please use this datasource in any ZenML "
        "pipeline with `pipeline.add_datasource("
        "datasource)`",
    ):
        super().__init__(message)

GitException (Exception)

Raises exception when a problem occurs in git resolution.

Source code in zenml/exceptions.py
class GitException(Exception):
    """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)

InitializationException (Exception)

Raises exception when a function is run before zenml initialization.

Source code in zenml/exceptions.py
class InitializationException(Exception):
    """Raises exception when a function is run before zenml initialization."""

    def __init__(
        self, message: str = "ZenML config is none. Did you do `zenml init`?"
    ):
        super().__init__(message)

IntegrationError (Exception)

Raises exceptions when a requested integration can not be activated.

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

MissingStepParameterError (Exception)

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

Source code in zenml/exceptions.py
class MissingStepParameterError(Exception):
    """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 (Exception)

Raises exceptions when a pipeline configuration contains invalid values.

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

PipelineInterfaceError (Exception)

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

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

PipelineNotSucceededException (Exception)

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

Source code in zenml/exceptions.py
class PipelineNotSucceededException(Exception):
    """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))

StepContextError (Exception)

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

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

StepInterfaceError (Exception)

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

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