Get arbitrary artifacts in a step

Not all artifacts need to come through the step interface from direct upstream steps.

As described in the metadata guide, the metadata can be fetched with the client, and this is how you would use it to fetch it within a step. This allows you to fetch artifacts from other upstream steps or even completely different pipelines.

from zenml.client import Client

from zenml import step

@step

def my_step():

client = Client()

# Directly fetch an artifact

output = client.get_artifact_version("my_dataset", "my_version")

output.run_metadata["accuracy"].value

This is one of the ways you can access artifacts that have already been created and stored in the artifact store. This can be useful when you want to use artifacts from other pipelines or steps that are not directly upstream.

See Also

Managing artifacts - learn about the ExternalArtifact type and how to pass artifacts between steps.

PreviousOrganize data with tags

NextHandle custom data types

Last updated 19 days ago