e details of the deployment process from the user.It needs to act as a ZenML BaseService registry, where every BaseService instance is used as an internal representation of a remote model server (see the find_model_server abstract method). To achieve this, it must be able to re-create the configuration of a BaseService from information that is persisted externally, alongside, or even as part of the remote model server configuration itself. For example, for model servers that are implemented as Kubernetes resources, the BaseService instances can be serialized and saved as Kubernetes resource annotations. This allows the model deployer to keep track of all externally running model servers and to re-create their corresponding BaseService instance representations at any given time. The model deployer also defines methods that implement basic life-cycle management on remote model servers outside the coverage of a pipeline (see stop_model_server , start_model_server and delete_model_server).

Putting all these considerations together, we end up with the following interface:

from abc import ABC, abstractmethod

from typing import Dict, List, Optional, Type

from uuid import UUID

from zenml.enums import StackComponentType

from zenml.services import BaseService, ServiceConfig

from zenml.stack import StackComponent, StackComponentConfig, Flavor

DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT = 300

class BaseModelDeployerConfig(StackComponentConfig):

"""Base class for all ZenML model deployer configurations."""

class BaseModelDeployer(StackComponent, ABC):

"""Base class for all ZenML model deployers."""

@abstractmethod

def perform_deploy_model(

self,

id: UUID,

config: ServiceConfig,

timeout: int = DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT,

) -> BaseService:

"""Abstract method to deploy a model."""

@staticmethod

@abstractmethod

def get_model_server_info(

service: BaseService,

) -> Dict[str, Optional[str]]:

"""Give implementation-specific way to extract relevant model server

properties for the user."""