Use this file to discover all available pages before exploring further.
Stack components are the building blocks of a ZenML stack. Each component represents a different category of infrastructure or tooling that your ML workflows need. Understanding these components helps you build the right infrastructure for your use case.
# Local Orchestrator - Run in your local environmentzenml orchestrator register local_orch --flavor=local# Kubernetes - Run on Kubernetes clusterzenml orchestrator register k8s_orch \ --flavor=kubernetes \ --kubernetes_context=my-cluster \ --kubernetes_namespace=zenml# Kubeflow - Run on Kubeflow Pipelineszenml orchestrator register kfp_orch \ --flavor=kubeflow \ --kubeflow_hostname=https://kubeflow.example.com# Vertex AI - Run on Google Cloud Vertex AIzenml orchestrator register vertex_orch \ --flavor=vertex \ --project=my-gcp-project \ --location=us-central1# Airflow - Run on Apache Airflowzenml orchestrator register airflow_orch \ --flavor=airflow \ --airflow_home=/path/to/airflow
from zenml import pipeline@pipelinedef my_pipeline(): """Pipeline runs on the active stack's orchestrator.""" step_one() step_two()# The orchestrator determines execution:# - Local: Sequential execution in current process# - Kubernetes: Distributed execution across pods# - Vertex AI: Managed execution on Google Cloud
from zenml import step, pipelinefrom zenml.integrations.seldon.steps import seldon_model_deployer_step@stepdef train_step() -> Any: model = train_model() return model@pipelinedef deployment_pipeline(): model = train_step() # Deploy model as a service seldon_model_deployer_step( model=model, service_config={"name": "my-model-service"} )
from zenml import step, Modelfrom zenml.client import Client@stepdef register_model_step(model: Any) -> None: """Register model in the registry.""" client = Client() # Model is automatically registered if model registry is in stack model_registry = client.active_stack.model_registry if model_registry: model_registry.register_model( name="my_model", version="v1.0", model_source_uri="path/to/model" )
from zenml import step@stepdef get_features_step(entity_ids: list) -> pd.DataFrame: """Retrieve features from feature store.""" from zenml.client import Client feature_store = Client().active_stack.feature_store features = feature_store.get_online_features( feature_refs=["feature_view:feature_1", "feature_view:feature_2"], entity_rows=[{"entity_id": id} for id in entity_ids] ) return features.to_df()
# List all components of a typezenml orchestrator list# Describe specific componentzenml orchestrator describe kubernetes_orch# Update componentzenml orchestrator update kubernetes_orch \ --kubernetes_namespace=production
from zenml.client import Clientfrom zenml.enums import StackComponentTypeclient = Client()# List all orchestratorsorchestrators = client.list_stack_components( component_type=StackComponentType.ORCHESTRATOR)for orch in orchestrators: print(f"Orchestrator: {orch.name} ({orch.flavor})")# Get specific componentartifact_store = client.get_stack_component( component_type=StackComponentType.ARTIFACT_STORE, name_id_or_prefix="s3_store")
Each component type has multiple flavors (implementations):
from zenml.client import Clientfrom zenml.enums import StackComponentTypeclient = Client()# List available flavors for a component typeflavors = client.list_flavors( component_type=StackComponentType.ORCHESTRATOR)for flavor in flavors: print(f"Flavor: {flavor.name}") print(f"Integration: {flavor.integration}")