Develop a custom orchestrator
Learning how to develop a custom orchestrator.
Base Implementation
from abc import ABC, abstractmethod
from typing import Any, Dict, Type
from zenml.models import PipelineDeploymentResponseModel, PipelineRunResponse
from zenml.enums import StackComponentType
from zenml.stack import StackComponent, StackComponentConfig, Stack, Flavor
class BaseOrchestratorConfig(StackComponentConfig):
"""Base class for all ZenML orchestrator configurations."""
class BaseOrchestrator(StackComponent, ABC):
"""Base class for all ZenML orchestrators"""
def submit_pipeline(
self,
deployment: "PipelineDeploymentResponse",
stack: "Stack",
environment: Dict[str, str],
placeholder_run: Optional["PipelineRunResponse"] = None,
) -> Optional[SubmissionResult]:
"""Submits a pipeline to the orchestrator."""
@abstractmethod
def get_orchestrator_run_id(self) -> str:
"""Returns the run id of the active orchestrator run.
Important: This needs to be a unique ID and return the same value for
all steps of a pipeline run.
Returns:
The orchestrator run id.
"""
class BaseOrchestratorFlavor(Flavor):
"""Base orchestrator for all ZenML orchestrator flavors."""
@property
@abstractmethod
def name(self):
"""Returns the name of the flavor."""
@property
def type(self) -> StackComponentType:
"""Returns the flavor type."""
return StackComponentType.ORCHESTRATOR
@property
def config_class(self) -> Type[BaseOrchestratorConfig]:
"""Config class for the base orchestrator flavor."""
return BaseOrchestratorConfig
@property
@abstractmethod
def implementation_class(self) -> Type["BaseOrchestrator"]:
"""Implementation class for this flavor."""Build your own custom orchestrator
Implementation guide
Optional features
Code sample
Enabling CUDA for GPU-backed hardware
Last updated
Was this helpful?