Skip to content

Artifact Stores

zenml.artifact_stores special

Artifact Stores

In ZenML, the inputs and outputs which go through any step is treated as an artifact and as its name suggests, an ArtifactStore is a place where these artifacts get stored.

Out of the box, ZenML comes with the BaseArtifactStore and LocalArtifactStore implementations. While the BaseArtifactStore establishes an interface for people who want to extend it to their needs, the LocalArtifactStore is a simple implementation for a local setup.

Moreover, additional artifact stores can be found in specific integrations modules, such as the GCPArtifactStore in the gcp integration and the AzureArtifactStore in the azure integration.

base_artifact_store

BaseArtifactStore (StackComponent, ABC) pydantic-model

Base class for all ZenML artifact stores.

Attributes:

Name Type Description
path str

The root path of the artifact store.

Source code in zenml/artifact_stores/base_artifact_store.py
class BaseArtifactStore(StackComponent, ABC):
    """Base class for all ZenML artifact stores.

    Attributes:
        path: The root path of the artifact store.
    """

    path: str

    @property
    def type(self) -> StackComponentType:
        """The component type."""
        return StackComponentType.ARTIFACT_STORE

    @property
    @abstractmethod
    def flavor(self) -> ArtifactStoreFlavor:
        """The artifact store flavor."""
flavor: ArtifactStoreFlavor property readonly

The artifact store flavor.

type: StackComponentType property readonly

The component type.

local_artifact_store

LocalArtifactStore (BaseArtifactStore) pydantic-model

Artifact Store for local artifacts.

Source code in zenml/artifact_stores/local_artifact_store.py
class LocalArtifactStore(BaseArtifactStore):
    """Artifact Store for local artifacts."""

    supports_local_execution = True
    supports_remote_execution = False

    @property
    def flavor(self) -> ArtifactStoreFlavor:
        """The artifact store flavor."""
        return ArtifactStoreFlavor.LOCAL

    @validator("path")
    def ensure_path_is_local(cls, path: str) -> str:
        """Ensures that the artifact store path is local."""
        if fileio.is_remote(path):
            raise ValueError(
                f"Path '{path}' specified for LocalArtifactStore is not a "
                f"local path."
            )
        return path
flavor: ArtifactStoreFlavor property readonly

The artifact store flavor.

ensure_path_is_local(path) classmethod

Ensures that the artifact store path is local.

Source code in zenml/artifact_stores/local_artifact_store.py
@validator("path")
def ensure_path_is_local(cls, path: str) -> str:
    """Ensures that the artifact store path is local."""
    if fileio.is_remote(path):
        raise ValueError(
            f"Path '{path}' specified for LocalArtifactStore is not a "
            f"local path."
        )
    return path