Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 1 addition & 30 deletions src/zenml/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@

import os
import platform
from pathlib import Path
from typing import Dict

import distro

from zenml import __version__
from zenml.constants import INSIDE_ZENML_CONTAINER
from zenml.enums import EnvironmentType
from zenml.logger import get_logger
Expand Down Expand Up @@ -88,35 +86,8 @@ def get_environment() -> str:
return EnvironmentType.NATIVE


def get_system_details() -> str:
"""Returns OS, python and ZenML information.

Returns:
str: OS, python and ZenML information
"""
from zenml.integrations.registry import integration_registry

info = {
"ZenML version": __version__,
"Install path": Path(__file__).resolve().parent,
"Python version": Environment.python_version(),
"Platform information": Environment.get_system_info(),
"Environment": get_environment(),
"Integrations": integration_registry.get_installed_integrations(),
}
return "\n".join(
"{:>10} {}".format(k + ":", str(v).replace("\n", " "))
for k, v in info.items()
)


class Environment(metaclass=SingletonMetaClass):
"""Provides environment information.

Individual environment components can be registered separately to extend
the global Environment object with additional information (see
`BaseEnvironmentComponent`).
"""
"""Provides environment information."""

def __init__(self) -> None:
"""Initializes an Environment instance.
Expand Down
78 changes: 0 additions & 78 deletions src/zenml/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,40 +70,6 @@ def __init__(self, message: str):
super().__init__(message)


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.",
):
"""Initializes the exception.

Args:
name: Name of the pipeline.
message: Message with details of exception.
"""
super().__init__(message.format(name))


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.",
):
"""Initializes the exception.

Args:
message: Message with details of exception.
"""
super().__init__(message)


class StepInterfaceError(ZenMLBaseException):
"""Raises exception when interacting with the Step interface in an unsupported way."""

Expand All @@ -116,50 +82,18 @@ class StepContextError(ZenMLBaseException):
"""Raises exception when interacting with a StepContext in an unsupported way."""


class PipelineInterfaceError(ZenMLBaseException):
"""Raises exception when interacting with the Pipeline interface in an unsupported way."""


class ArtifactInterfaceError(ZenMLBaseException):
"""Raises exception when interacting with the Artifact interface in an unsupported way."""


class StackComponentInterfaceError(ZenMLBaseException):
"""Raises exception when interacting with the stack components in an unsupported way."""


class StackComponentDeploymentError(ZenMLBaseException):
"""Raises exception when deploying a stack component fails."""


class ArtifactStoreInterfaceError(ZenMLBaseException):
"""Raises exception when interacting with the Artifact Store interface in an unsupported way."""


class PipelineConfigurationError(ZenMLBaseException):
"""Raises exceptions when a pipeline configuration contains invalid values."""


class IntegrationError(ZenMLBaseException):
"""Raises exceptions when a requested integration can not be activated."""


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.",
):
"""Initializes the exception.

Args:
message: Message with details of exception.
"""
super().__init__(message)


class ValidationError(ZenMLBaseException):
"""Raised when the Model passed to the ZenStore."""

Expand All @@ -180,22 +114,10 @@ class StackValidationError(ZenMLBaseException):
"""Raised when a stack configuration is not valid."""


class StackComponentValidationError(ZenMLBaseException):
"""Raised when a stack component configuration is not valid."""


class ProvisioningError(ZenMLBaseException):
"""Raised when an error occurs when provisioning resources for a StackComponent."""


class GitNotFoundError(ImportError):
"""Raised when ZenML CLI is used to interact with examples on a machine with no git installation."""


class DuplicatedConfigurationError(ZenMLBaseException):
"""Raised when a configuration parameter is set twice."""


class IllegalOperationError(ZenMLBaseException):
"""Raised when an illegal operation is attempted."""

Expand Down
2 changes: 0 additions & 2 deletions src/zenml/zen_server/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
AuthorizationException,
CredentialsNotValid,
DoesNotExistException,
DuplicateRunNameError,
EntityCreationError,
EntityExistsError,
IllegalOperationError,
Expand Down Expand Up @@ -69,7 +68,6 @@ class ErrorModel(BaseModel):
# different status codes (e.g. `ValueError` and the 400 and 422 status codes).
REST_API_EXCEPTIONS: List[Tuple[Type[Exception], int]] = [
# 409 Conflict
(DuplicateRunNameError, 409),
(EntityExistsError, 409),
# 403 Forbidden
(IllegalOperationError, 403),
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/zen_server/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from zenml.exceptions import (
AuthorizationException,
DoesNotExistException,
DuplicateRunNameError,
EntityExistsError,
IllegalOperationError,
ValidationError,
Expand Down Expand Up @@ -58,7 +57,6 @@ def get_exception(exception_type: Type[Exception]) -> Exception:
EntityExistsError,
EntityExistsError,
EntityExistsError,
DuplicateRunNameError,
EntityExistsError,
IllegalOperationError,
AuthorizationException,
Expand Down Expand Up @@ -105,7 +103,6 @@ def test_http_exception_reconstruction(exception_type: Type[Exception]):
EntityExistsError,
EntityExistsError,
EntityExistsError,
DuplicateRunNameError,
EntityExistsError,
IllegalOperationError,
AuthorizationException,
Expand Down
Loading