Seldon
zenml.integrations.seldon
Initialization of the Seldon integration.
The Seldon Core integration allows you to use the Seldon Core model serving platform to implement continuous model deployment.
Attributes
SELDON = 'seldon'
module-attribute
SELDON_MODEL_DEPLOYER_FLAVOR = 'seldon'
module-attribute
Classes
Flavor
Class for ZenML Flavors.
Attributes
config_class: Type[StackComponentConfig]
abstractmethod
property
Returns StackComponentConfig
config class.
Returns:
Type | Description |
---|---|
Type[StackComponentConfig]
|
The config class. |
config_schema: Dict[str, Any]
property
The config schema for a flavor.
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The config schema. |
docs_url: Optional[str]
property
A url to point at docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor docs url. |
implementation_class: Type[StackComponent]
abstractmethod
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[StackComponent]
|
The implementation class for this flavor. |
logo_url: Optional[str]
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
Optional[str]
|
The flavor logo. |
name: str
abstractmethod
property
The flavor name.
Returns:
Type | Description |
---|---|
str
|
The flavor name. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
type: StackComponentType
abstractmethod
property
Functions
from_model(flavor_model: FlavorResponse) -> Flavor
classmethod
Loads a flavor from a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flavor_model
|
FlavorResponse
|
The model to load from. |
required |
Raises:
Type | Description |
---|---|
CustomFlavorImportError
|
If the custom flavor can't be imported. |
ImportError
|
If the flavor can't be imported. |
Returns:
Type | Description |
---|---|
Flavor
|
The loaded flavor. |
Source code in src/zenml/stack/flavor.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
generate_default_docs_url() -> str
Generate the doc urls for all inbuilt and integration flavors.
Note that this method is not going to be useful for custom flavors, which do not have any docs in the main zenml docs.
Returns:
Type | Description |
---|---|
str
|
The complete url to the zenml documentation |
Source code in src/zenml/stack/flavor.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
|
generate_default_sdk_docs_url() -> str
Generate SDK docs url for a flavor.
Returns:
Type | Description |
---|---|
str
|
The complete url to the zenml SDK docs |
Source code in src/zenml/stack/flavor.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
|
to_model(integration: Optional[str] = None, is_custom: bool = True) -> FlavorRequest
Converts a flavor to a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
integration
|
Optional[str]
|
The integration to use for the model. |
None
|
is_custom
|
bool
|
Whether the flavor is a custom flavor. |
True
|
Returns:
Type | Description |
---|---|
FlavorRequest
|
The model. |
Source code in src/zenml/stack/flavor.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
Integration
Base class for integration in ZenML.
Functions
activate() -> None
classmethod
Abstract method to activate the integration.
Source code in src/zenml/integrations/integration.py
175 176 177 |
|
check_installation() -> bool
classmethod
Method to check whether the required packages are installed.
Returns:
Type | Description |
---|---|
bool
|
True if all required packages are installed, False otherwise. |
Source code in src/zenml/integrations/integration.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
flavors() -> List[Type[Flavor]]
classmethod
Abstract method to declare new stack component flavors.
Returns:
Type | Description |
---|---|
List[Type[Flavor]]
|
A list of new stack component flavors. |
Source code in src/zenml/integrations/integration.py
179 180 181 182 183 184 185 186 |
|
get_requirements(target_os: Optional[str] = None, python_version: Optional[str] = None) -> List[str]
classmethod
Method to get the requirements for the integration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_os
|
Optional[str]
|
The target operating system to get the requirements for. |
None
|
python_version
|
Optional[str]
|
The Python version to use for the requirements. |
None
|
Returns:
Type | Description |
---|---|
List[str]
|
A list of requirements. |
Source code in src/zenml/integrations/integration.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|
get_uninstall_requirements(target_os: Optional[str] = None) -> List[str]
classmethod
Method to get the uninstall requirements for the integration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_os
|
Optional[str]
|
The target operating system to get the requirements for. |
None
|
Returns:
Type | Description |
---|---|
List[str]
|
A list of requirements. |
Source code in src/zenml/integrations/integration.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
plugin_flavors() -> List[Type[BasePluginFlavor]]
classmethod
Abstract method to declare new plugin flavors.
Returns:
Type | Description |
---|---|
List[Type[BasePluginFlavor]]
|
A list of new plugin flavors. |
Source code in src/zenml/integrations/integration.py
188 189 190 191 192 193 194 195 |
|
SeldonIntegration
Bases: Integration
Definition of Seldon Core integration for ZenML.
Functions
activate() -> None
classmethod
Activate the Seldon Core integration.
Source code in src/zenml/integrations/seldon/__init__.py
38 39 40 41 42 |
|
flavors() -> List[Type[Flavor]]
classmethod
Declare the stack component flavors for the Seldon Core.
Returns:
Type | Description |
---|---|
List[Type[Flavor]]
|
List of stack component flavors for this integration. |
Source code in src/zenml/integrations/seldon/__init__.py
44 45 46 47 48 49 50 51 52 53 |
|
get_requirements(target_os: Optional[str] = None, python_version: Optional[str] = None) -> List[str]
classmethod
Method to get the requirements for the integration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_os
|
Optional[str]
|
The target operating system to get the requirements for. |
None
|
python_version
|
Optional[str]
|
The Python version to use for the requirements. |
None
|
Returns:
Type | Description |
---|---|
List[str]
|
A list of requirements. |
Source code in src/zenml/integrations/seldon/__init__.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
Modules
constants
Seldon constants.
custom_deployer
Initialization of ZenML custom deployer.
Classes
Modules
zenml_custom_model
Implements a custom model for the Seldon integration.
ZenMLCustomModel(model_name: str, model_uri: str, predict_func: str)
Custom model class for ZenML and Seldon.
This class is used to implement a custom model for the Seldon Core integration, which is used as the main entry point for custom code execution.
Attributes:
Name | Type | Description |
---|---|---|
name |
The name of the model. |
|
model_uri |
The URI of the model. |
|
predict_func |
The predict function of the model. |
Initializes a ZenMLCustomModel object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_name
|
str
|
The name of the model. |
required |
model_uri
|
str
|
The URI of the model. |
required |
predict_func
|
str
|
The predict function of the model. |
required |
Source code in src/zenml/integrations/seldon/custom_deployer/zenml_custom_model.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
load() -> bool
Load the model.
This function loads the model into memory and sets the ready flag to True. The model is loaded using the materializer, by saving the information of the artifact to a file at the preparing time and loading it again at the prediction time by the materializer.
Returns:
Type | Description |
---|---|
bool
|
True if the model was loaded successfully, False otherwise. |
Source code in src/zenml/integrations/seldon/custom_deployer/zenml_custom_model.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
predict(X: Array_Like, features_names: Optional[List[str]], **kwargs: Any) -> Array_Like
Predict the given request.
The main predict function of the model. This function is called by the Seldon Core server when a request is received. Then inside this function, the user-defined predict function is called.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
Array_Like
|
The request to predict in a dictionary. |
required |
features_names
|
Optional[List[str]]
|
The names of the features. |
required |
**kwargs
|
Any
|
Additional arguments. |
{}
|
Returns:
Type | Description |
---|---|
Array_Like
|
The prediction dictionary. |
Raises:
Type | Description |
---|---|
Exception
|
If function could not be called. |
NotImplementedError
|
If the model is not ready. |
TypeError
|
If the request is not a dictionary. |
Source code in src/zenml/integrations/seldon/custom_deployer/zenml_custom_model.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
main(model_name: str, model_uri: str, predict_func: str) -> None
Main function for the custom model.
Within the deployment process, the built-in custom deployment step is used to to prepare the Seldon Core deployment with an entry point that calls this script, which then starts a subprocess to start the Seldon server and waits for requests.
The following is an example of the entry point:
entrypoint_command = [
"python",
"-m",
"zenml.integrations.seldon.custom_deployer.zenml_custom_model",
"--model_name",
config.service_config.model_name,
"--predict_func",
config.custom_deploy_parameters.predict_function,
]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_name
|
str
|
The name of the model. |
required |
model_uri
|
str
|
The URI of the model. |
required |
predict_func
|
str
|
The path to the predict function. |
required |
Source code in src/zenml/integrations/seldon/custom_deployer/zenml_custom_model.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
|
flavors
Seldon integration flavors.
Classes
SeldonModelDeployerConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseModelDeployerConfig
Config for the Seldon Model Deployer.
Attributes:
Name | Type | Description |
---|---|---|
kubernetes_context |
Optional[str]
|
the Kubernetes context to use to contact the remote Seldon Core installation. If not specified, the current configuration is used. Depending on where the Seldon model deployer is being used, this can be either a locally active context or an in-cluster Kubernetes configuration (if running inside a pod). If the model deployer stack component is linked to a Kubernetes service connector, this field is ignored. |
kubernetes_namespace |
Optional[str]
|
the Kubernetes namespace where the Seldon Core deployment servers are provisioned and managed by ZenML. If not specified, the namespace set in the current configuration is used. Depending on where the Seldon model deployer is being used, this can be either the current namespace configured in the locally active context or the namespace in the context of which the pod is running (if running inside a pod). If the model deployer stack component is linked to a Kubernetes service connector, this field is mandatory. |
base_url |
str
|
the base URL of the Kubernetes ingress used to expose the Seldon Core deployment servers. |
secret |
Optional[str]
|
the name of a ZenML secret containing the credentials used by Seldon Core storage initializers to authenticate to the Artifact Store (i.e. the storage backend where models are stored - see https://docs.seldon.io/projects/seldon-core/en/latest/servers/overview.html#handling-credentials). |
kubernetes_secret_name |
Optional[str]
|
the name of the Kubernetes secret containing the credentials used by Seldon Core storage initializers to authenticate to the Artifact Store (i.e. the storage backend where models are stored) - This is used when the secret is not managed by ZenML and is already present in the Kubernetes cluster. |
Source code in src/zenml/stack/stack_component.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
SeldonModelDeployerFlavor
Bases: BaseModelDeployerFlavor
Seldon Core model deployer flavor.
config_class: Type[SeldonModelDeployerConfig]
property
Returns SeldonModelDeployerConfig
config class.
Returns:
Type | Description |
---|---|
Type[SeldonModelDeployerConfig]
|
The config class. |
docs_url: Optional[str]
property
A url to point at docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor docs url. |
implementation_class: Type[SeldonModelDeployer]
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[SeldonModelDeployer]
|
The implementation class. |
logo_url: str
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
str
|
The flavor logo. |
name: str
property
Name of the flavor.
Returns:
Type | Description |
---|---|
str
|
The name of the flavor. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
Modules
seldon_model_deployer_flavor
Seldon model deployer flavor.
SeldonModelDeployerConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseModelDeployerConfig
Config for the Seldon Model Deployer.
Attributes:
Name | Type | Description |
---|---|---|
kubernetes_context |
Optional[str]
|
the Kubernetes context to use to contact the remote Seldon Core installation. If not specified, the current configuration is used. Depending on where the Seldon model deployer is being used, this can be either a locally active context or an in-cluster Kubernetes configuration (if running inside a pod). If the model deployer stack component is linked to a Kubernetes service connector, this field is ignored. |
kubernetes_namespace |
Optional[str]
|
the Kubernetes namespace where the Seldon Core deployment servers are provisioned and managed by ZenML. If not specified, the namespace set in the current configuration is used. Depending on where the Seldon model deployer is being used, this can be either the current namespace configured in the locally active context or the namespace in the context of which the pod is running (if running inside a pod). If the model deployer stack component is linked to a Kubernetes service connector, this field is mandatory. |
base_url |
str
|
the base URL of the Kubernetes ingress used to expose the Seldon Core deployment servers. |
secret |
Optional[str]
|
the name of a ZenML secret containing the credentials used by Seldon Core storage initializers to authenticate to the Artifact Store (i.e. the storage backend where models are stored - see https://docs.seldon.io/projects/seldon-core/en/latest/servers/overview.html#handling-credentials). |
kubernetes_secret_name |
Optional[str]
|
the name of the Kubernetes secret containing the credentials used by Seldon Core storage initializers to authenticate to the Artifact Store (i.e. the storage backend where models are stored) - This is used when the secret is not managed by ZenML and is already present in the Kubernetes cluster. |
Source code in src/zenml/stack/stack_component.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
SeldonModelDeployerFlavor
Bases: BaseModelDeployerFlavor
Seldon Core model deployer flavor.
config_class: Type[SeldonModelDeployerConfig]
property
Returns SeldonModelDeployerConfig
config class.
Returns:
Type | Description |
---|---|
Type[SeldonModelDeployerConfig]
|
The config class. |
docs_url: Optional[str]
property
A url to point at docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor docs url. |
implementation_class: Type[SeldonModelDeployer]
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[SeldonModelDeployer]
|
The implementation class. |
logo_url: str
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
str
|
The flavor logo. |
name: str
property
Name of the flavor.
Returns:
Type | Description |
---|---|
str
|
The name of the flavor. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
model_deployers
Initialization of the Seldon Model Deployer.
Classes
SeldonModelDeployer(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, labels: Optional[Dict[str, Any]] = None, connector_requirements: Optional[ServiceConnectorRequirements] = None, connector: Optional[UUID] = None, connector_resource_id: Optional[str] = None, *args: Any, **kwargs: Any)
Bases: BaseModelDeployer
Seldon Core model deployer stack component implementation.
Source code in src/zenml/stack/stack_component.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
config: SeldonModelDeployerConfig
property
Returns the SeldonModelDeployerConfig
config.
Returns:
Type | Description |
---|---|
SeldonModelDeployerConfig
|
The configuration. |
kubernetes_secret_name: str
property
Get the Kubernetes secret name associated with this model deployer.
If a pre-existing Kubernetes secret is configured for this model deployer, that name is returned to be used by all Seldon Core deployments associated with this model deployer.
Otherwise, a Kubernetes secret name is generated based on the ID of the active artifact store. The reason for this is that the same model deployer may be used to deploy models in combination with different artifact stores at the same time, and each artifact store may require different credentials to be accessed.
Returns:
Type | Description |
---|---|
str
|
The name of a Kubernetes secret to be used with Seldon Core |
str
|
deployments. |
seldon_client: SeldonClient
property
Get the Seldon Core client associated with this model deployer.
Returns:
Type | Description |
---|---|
SeldonClient
|
The Seldon Core client. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the Kubernetes namespace is not configured when using a service connector to deploy models with Seldon Core. |
validator: Optional[StackValidator]
property
Ensures there is a container registry and image builder in the stack.
Returns:
Type | Description |
---|---|
Optional[StackValidator]
|
A |
get_docker_builds(deployment: PipelineDeploymentBase) -> List[BuildConfiguration]
Gets the Docker builds required for the component.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
PipelineDeploymentBase
|
The pipeline deployment for which to get the builds. |
required |
Returns:
Type | Description |
---|---|
List[BuildConfiguration]
|
The required Docker builds. |
Source code in src/zenml/integrations/seldon/model_deployers/seldon_model_deployer.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
get_model_server_info(service_instance: SeldonDeploymentService) -> Dict[str, Optional[str]]
staticmethod
Return implementation specific information that might be relevant to the user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_instance
|
SeldonDeploymentService
|
Instance of a SeldonDeploymentService |
required |
Returns:
Type | Description |
---|---|
Dict[str, Optional[str]]
|
Model server information. |
Source code in src/zenml/integrations/seldon/model_deployers/seldon_model_deployer.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
perform_delete_model(service: BaseService, timeout: int = DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT, force: bool = False) -> None
Delete a Seldon Core model deployment server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service
|
BaseService
|
The service to delete. |
required |
timeout
|
int
|
timeout in seconds to wait for the service to stop. If set to 0, the method will return immediately after deprovisioning the service, without waiting for it to stop. |
DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT
|
force
|
bool
|
if True, force the service to stop. |
False
|
Source code in src/zenml/integrations/seldon/model_deployers/seldon_model_deployer.py
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
|
perform_deploy_model(id: UUID, config: ServiceConfig, timeout: int = DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT) -> BaseService
Create a new Seldon Core deployment or update an existing one.
noqa: DAR402
This should serve the supplied model and deployment configuration.
This method has two modes of operation, depending on the replace
argument value:
-
if
replace
is False, calling this method will create a new Seldon Core deployment server to reflect the model and other configuration parameters specified in the supplied Seldon deploymentconfig
. -
if
replace
is True, this method will first attempt to find an existing Seldon Core deployment that is equivalent to the supplied configuration parameters. Two or more Seldon Core deployments are considered equivalent if they have the samepipeline_name
,pipeline_step_name
andmodel_name
configuration parameters. To put it differently, two Seldon Core deployments are equivalent if they serve versions of the same model deployed by the same pipeline step. If an equivalent Seldon Core deployment is found, it will be updated in place to reflect the new configuration parameters. This allows an existing Seldon Core deployment to retain its prediction URL while performing a rolling update to serve a new model version.
Callers should set replace
to True if they want a continuous model
deployment workflow that doesn't spin up a new Seldon Core deployment
server for each new model version. If multiple equivalent Seldon Core
deployments are found, the most recently created deployment is selected
to be updated and the others are deleted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
UUID
|
the UUID of the model server to deploy. |
required |
config
|
ServiceConfig
|
the configuration of the model to be deployed with Seldon. Core |
required |
timeout
|
int
|
the timeout in seconds to wait for the Seldon Core server to be provisioned and successfully started or updated. If set to 0, the method will return immediately after the Seldon Core server is provisioned, without waiting for it to fully start. |
DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT
|
Returns:
Type | Description |
---|---|
BaseService
|
The ZenML Seldon Core deployment service object that can be used to |
BaseService
|
interact with the remote Seldon Core server. |
Raises:
Type | Description |
---|---|
SeldonClientError
|
if a Seldon Core client error is encountered while provisioning the Seldon Core deployment server. |
RuntimeError
|
if |
Source code in src/zenml/integrations/seldon/model_deployers/seldon_model_deployer.py
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 |
|
perform_start_model(service: BaseService, timeout: int = DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT) -> BaseService
Start a Seldon Core model deployment server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service
|
BaseService
|
The service to start. |
required |
timeout
|
int
|
timeout in seconds to wait for the service to become active. . If set to 0, the method will return immediately after provisioning the service, without waiting for it to become active. |
DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT
|
Raises:
Type | Description |
---|---|
NotImplementedError
|
since we don't support starting Seldon Core model servers |
Source code in src/zenml/integrations/seldon/model_deployers/seldon_model_deployer.py
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 |
|
perform_stop_model(service: BaseService, timeout: int = DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT, force: bool = False) -> BaseService
Stop a Seldon Core model server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service
|
BaseService
|
The service to stop. |
required |
timeout
|
int
|
timeout in seconds to wait for the service to stop. |
DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT
|
force
|
bool
|
if True, force the service to stop. |
False
|
Raises:
Type | Description |
---|---|
NotImplementedError
|
stopping Seldon Core model servers is not supported. |
Source code in src/zenml/integrations/seldon/model_deployers/seldon_model_deployer.py
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
|
Modules
seldon_model_deployer
Implementation of the Seldon Model Deployer.
SeldonModelDeployer(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, labels: Optional[Dict[str, Any]] = None, connector_requirements: Optional[ServiceConnectorRequirements] = None, connector: Optional[UUID] = None, connector_resource_id: Optional[str] = None, *args: Any, **kwargs: Any)
Bases: BaseModelDeployer
Seldon Core model deployer stack component implementation.
Source code in src/zenml/stack/stack_component.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
config: SeldonModelDeployerConfig
property
Returns the SeldonModelDeployerConfig
config.
Returns:
Type | Description |
---|---|
SeldonModelDeployerConfig
|
The configuration. |
kubernetes_secret_name: str
property
Get the Kubernetes secret name associated with this model deployer.
If a pre-existing Kubernetes secret is configured for this model deployer, that name is returned to be used by all Seldon Core deployments associated with this model deployer.
Otherwise, a Kubernetes secret name is generated based on the ID of the active artifact store. The reason for this is that the same model deployer may be used to deploy models in combination with different artifact stores at the same time, and each artifact store may require different credentials to be accessed.
Returns:
Type | Description |
---|---|
str
|
The name of a Kubernetes secret to be used with Seldon Core |
str
|
deployments. |
seldon_client: SeldonClient
property
Get the Seldon Core client associated with this model deployer.
Returns:
Type | Description |
---|---|
SeldonClient
|
The Seldon Core client. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the Kubernetes namespace is not configured when using a service connector to deploy models with Seldon Core. |
validator: Optional[StackValidator]
property
Ensures there is a container registry and image builder in the stack.
Returns:
Type | Description |
---|---|
Optional[StackValidator]
|
A |
get_docker_builds(deployment: PipelineDeploymentBase) -> List[BuildConfiguration]
Gets the Docker builds required for the component.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
PipelineDeploymentBase
|
The pipeline deployment for which to get the builds. |
required |
Returns:
Type | Description |
---|---|
List[BuildConfiguration]
|
The required Docker builds. |
Source code in src/zenml/integrations/seldon/model_deployers/seldon_model_deployer.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
get_model_server_info(service_instance: SeldonDeploymentService) -> Dict[str, Optional[str]]
staticmethod
Return implementation specific information that might be relevant to the user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_instance
|
SeldonDeploymentService
|
Instance of a SeldonDeploymentService |
required |
Returns:
Type | Description |
---|---|
Dict[str, Optional[str]]
|
Model server information. |
Source code in src/zenml/integrations/seldon/model_deployers/seldon_model_deployer.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
perform_delete_model(service: BaseService, timeout: int = DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT, force: bool = False) -> None
Delete a Seldon Core model deployment server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service
|
BaseService
|
The service to delete. |
required |
timeout
|
int
|
timeout in seconds to wait for the service to stop. If set to 0, the method will return immediately after deprovisioning the service, without waiting for it to stop. |
DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT
|
force
|
bool
|
if True, force the service to stop. |
False
|
Source code in src/zenml/integrations/seldon/model_deployers/seldon_model_deployer.py
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
|
perform_deploy_model(id: UUID, config: ServiceConfig, timeout: int = DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT) -> BaseService
Create a new Seldon Core deployment or update an existing one.
noqa: DAR402
This should serve the supplied model and deployment configuration.
This method has two modes of operation, depending on the replace
argument value:
-
if
replace
is False, calling this method will create a new Seldon Core deployment server to reflect the model and other configuration parameters specified in the supplied Seldon deploymentconfig
. -
if
replace
is True, this method will first attempt to find an existing Seldon Core deployment that is equivalent to the supplied configuration parameters. Two or more Seldon Core deployments are considered equivalent if they have the samepipeline_name
,pipeline_step_name
andmodel_name
configuration parameters. To put it differently, two Seldon Core deployments are equivalent if they serve versions of the same model deployed by the same pipeline step. If an equivalent Seldon Core deployment is found, it will be updated in place to reflect the new configuration parameters. This allows an existing Seldon Core deployment to retain its prediction URL while performing a rolling update to serve a new model version.
Callers should set replace
to True if they want a continuous model
deployment workflow that doesn't spin up a new Seldon Core deployment
server for each new model version. If multiple equivalent Seldon Core
deployments are found, the most recently created deployment is selected
to be updated and the others are deleted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
UUID
|
the UUID of the model server to deploy. |
required |
config
|
ServiceConfig
|
the configuration of the model to be deployed with Seldon. Core |
required |
timeout
|
int
|
the timeout in seconds to wait for the Seldon Core server to be provisioned and successfully started or updated. If set to 0, the method will return immediately after the Seldon Core server is provisioned, without waiting for it to fully start. |
DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT
|
Returns:
Type | Description |
---|---|
BaseService
|
The ZenML Seldon Core deployment service object that can be used to |
BaseService
|
interact with the remote Seldon Core server. |
Raises:
Type | Description |
---|---|
SeldonClientError
|
if a Seldon Core client error is encountered while provisioning the Seldon Core deployment server. |
RuntimeError
|
if |
Source code in src/zenml/integrations/seldon/model_deployers/seldon_model_deployer.py
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 |
|
perform_start_model(service: BaseService, timeout: int = DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT) -> BaseService
Start a Seldon Core model deployment server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service
|
BaseService
|
The service to start. |
required |
timeout
|
int
|
timeout in seconds to wait for the service to become active. . If set to 0, the method will return immediately after provisioning the service, without waiting for it to become active. |
DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT
|
Raises:
Type | Description |
---|---|
NotImplementedError
|
since we don't support starting Seldon Core model servers |
Source code in src/zenml/integrations/seldon/model_deployers/seldon_model_deployer.py
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 |
|
perform_stop_model(service: BaseService, timeout: int = DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT, force: bool = False) -> BaseService
Stop a Seldon Core model server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service
|
BaseService
|
The service to stop. |
required |
timeout
|
int
|
timeout in seconds to wait for the service to stop. |
DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT
|
force
|
bool
|
if True, force the service to stop. |
False
|
Raises:
Type | Description |
---|---|
NotImplementedError
|
stopping Seldon Core model servers is not supported. |
Source code in src/zenml/integrations/seldon/model_deployers/seldon_model_deployer.py
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
|
secret_schemas
Initialization for the Seldon secret schemas.
These are secret schemas that can be used to authenticate Seldon to the Artifact Store used to store served ML models.
Classes
SeldonAzureSecretSchema
Bases: BaseSecretSchema
Seldon Azure Blob Storage credentials.
Based on: https://rclone.org/azureblob/
Attributes:
Name | Type | Description |
---|---|---|
rclone_config_az_type |
Literal['azureblob']
|
the rclone config type. Must be set to "azureblob" for this schema. |
rclone_config_az_env_auth |
bool
|
read credentials from runtime (environment variables or MSI). |
rclone_config_az_account |
Optional[str]
|
storage Account Name. Leave blank to use SAS URL or MSI. |
rclone_config_az_key |
Optional[str]
|
storage Account Key. Leave blank to use SAS URL or MSI. |
rclone_config_az_sas_url |
Optional[str]
|
SAS URL for container level access only. Leave blank if using account/key or MSI. |
rclone_config_az_use_msi |
bool
|
use a managed service identity to authenticate (only works in Azure). |
rclone_config_az_client_secret |
Optional[str]
|
client secret for service principal authentication. |
rclone_config_az_client_id |
Optional[str]
|
client id for service principal authentication. |
rclone_config_az_tenant |
Optional[str]
|
tenant id for service principal authentication. |
SeldonGSSecretSchema
Bases: BaseSecretSchema
Seldon GCS credentials.
Based on: https://rclone.org/googlecloudstorage/
Attributes:
Name | Type | Description |
---|---|---|
rclone_config_gs_type |
Literal['google cloud storage']
|
the rclone config type. Must be set to "google cloud storage" for this schema. |
rclone_config_gs_client_id |
Optional[str]
|
OAuth client id. |
rclone_config_gs_client_secret |
Optional[str]
|
OAuth client secret. |
rclone_config_gs_token |
Optional[str]
|
OAuth Access Token as a JSON blob. |
rclone_config_gs_project_number |
Optional[str]
|
project number. |
rclone_config_gs_service_account_credentials |
Optional[str]
|
service account credentials JSON blob. |
rclone_config_gs_anonymous |
bool
|
access public buckets and objects without credentials. Set to True if you just want to download files and don't configure credentials. |
rclone_config_gs_auth_url |
Optional[str]
|
auth server URL. |
SeldonS3SecretSchema
Bases: BaseSecretSchema
Seldon S3 credentials.
Based on: https://rclone.org/s3/#amazon-s3
Attributes:
Name | Type | Description |
---|---|---|
rclone_config_s3_type |
Literal['s3']
|
the rclone config type. Must be set to "s3" for this schema. |
rclone_config_s3_provider |
str
|
the S3 provider (e.g. aws, ceph, minio). |
rclone_config_s3_env_auth |
bool
|
get AWS credentials from EC2/ECS meta data (i.e. with IAM roles configuration). Only applies if access_key_id and secret_access_key are blank. |
rclone_config_s3_access_key_id |
Optional[str]
|
AWS Access Key ID. |
rclone_config_s3_secret_access_key |
Optional[str]
|
AWS Secret Access Key. |
rclone_config_s3_session_token |
Optional[str]
|
AWS Session Token. |
rclone_config_s3_region |
Optional[str]
|
region to connect to. |
rclone_config_s3_endpoint |
Optional[str]
|
S3 API endpoint. |
Modules
secret_schemas
Implementation for Seldon secret schemas.
SeldonAzureSecretSchema
Bases: BaseSecretSchema
Seldon Azure Blob Storage credentials.
Based on: https://rclone.org/azureblob/
Attributes:
Name | Type | Description |
---|---|---|
rclone_config_az_type |
Literal['azureblob']
|
the rclone config type. Must be set to "azureblob" for this schema. |
rclone_config_az_env_auth |
bool
|
read credentials from runtime (environment variables or MSI). |
rclone_config_az_account |
Optional[str]
|
storage Account Name. Leave blank to use SAS URL or MSI. |
rclone_config_az_key |
Optional[str]
|
storage Account Key. Leave blank to use SAS URL or MSI. |
rclone_config_az_sas_url |
Optional[str]
|
SAS URL for container level access only. Leave blank if using account/key or MSI. |
rclone_config_az_use_msi |
bool
|
use a managed service identity to authenticate (only works in Azure). |
rclone_config_az_client_secret |
Optional[str]
|
client secret for service principal authentication. |
rclone_config_az_client_id |
Optional[str]
|
client id for service principal authentication. |
rclone_config_az_tenant |
Optional[str]
|
tenant id for service principal authentication. |
SeldonGSSecretSchema
Bases: BaseSecretSchema
Seldon GCS credentials.
Based on: https://rclone.org/googlecloudstorage/
Attributes:
Name | Type | Description |
---|---|---|
rclone_config_gs_type |
Literal['google cloud storage']
|
the rclone config type. Must be set to "google cloud storage" for this schema. |
rclone_config_gs_client_id |
Optional[str]
|
OAuth client id. |
rclone_config_gs_client_secret |
Optional[str]
|
OAuth client secret. |
rclone_config_gs_token |
Optional[str]
|
OAuth Access Token as a JSON blob. |
rclone_config_gs_project_number |
Optional[str]
|
project number. |
rclone_config_gs_service_account_credentials |
Optional[str]
|
service account credentials JSON blob. |
rclone_config_gs_anonymous |
bool
|
access public buckets and objects without credentials. Set to True if you just want to download files and don't configure credentials. |
rclone_config_gs_auth_url |
Optional[str]
|
auth server URL. |
SeldonS3SecretSchema
Bases: BaseSecretSchema
Seldon S3 credentials.
Based on: https://rclone.org/s3/#amazon-s3
Attributes:
Name | Type | Description |
---|---|---|
rclone_config_s3_type |
Literal['s3']
|
the rclone config type. Must be set to "s3" for this schema. |
rclone_config_s3_provider |
str
|
the S3 provider (e.g. aws, ceph, minio). |
rclone_config_s3_env_auth |
bool
|
get AWS credentials from EC2/ECS meta data (i.e. with IAM roles configuration). Only applies if access_key_id and secret_access_key are blank. |
rclone_config_s3_access_key_id |
Optional[str]
|
AWS Access Key ID. |
rclone_config_s3_secret_access_key |
Optional[str]
|
AWS Secret Access Key. |
rclone_config_s3_session_token |
Optional[str]
|
AWS Session Token. |
rclone_config_s3_region |
Optional[str]
|
region to connect to. |
rclone_config_s3_endpoint |
Optional[str]
|
S3 API endpoint. |
seldon_client
Implementation of the Seldon client for ZenML.
Classes
SeldonClient(context: Optional[str], namespace: Optional[str], kube_client: Optional[k8s_client.ApiClient] = None)
A client for interacting with Seldon Deployments.
Initialize a Seldon Core client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context
|
Optional[str]
|
the Kubernetes context to use. |
required |
namespace
|
Optional[str]
|
the Kubernetes namespace to use. |
required |
kube_client
|
Optional[ApiClient]
|
a Kubernetes client to use. |
None
|
Source code in src/zenml/integrations/seldon/seldon_client.py
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
|
namespace: str
property
Returns the Kubernetes namespace in use by the client.
Returns:
Type | Description |
---|---|
str
|
The Kubernetes namespace in use by the client. |
Raises:
Type | Description |
---|---|
RuntimeError
|
if the namespace has not been configured. |
create_deployment(deployment: SeldonDeployment, poll_timeout: int = 0) -> SeldonDeployment
Create a Seldon Core deployment resource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
SeldonDeployment
|
the Seldon Core deployment resource to create |
required |
poll_timeout
|
int
|
the maximum time to wait for the deployment to become available or to fail. If set to 0, the function will return immediately without checking the deployment status. If a timeout occurs and the deployment is still pending creation, it will be returned anyway and no exception will be raised. |
0
|
Returns:
Type | Description |
---|---|
SeldonDeployment
|
the created Seldon Core deployment resource with updated status. |
Raises:
Type | Description |
---|---|
SeldonDeploymentExistsError
|
if a deployment with the same name already exists. |
SeldonClientError
|
if an unknown error occurs during the creation of the deployment. |
Source code in src/zenml/integrations/seldon/seldon_client.py
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 |
|
create_or_update_secret(name: str, secret_values: Dict[str, Any]) -> None
Create or update a Kubernetes Secret resource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
the name of the Secret resource to create. |
required |
secret_values
|
Dict[str, Any]
|
secret key-values that should be stored in the Secret resource. |
required |
Raises:
Type | Description |
---|---|
SeldonClientError
|
if an unknown error occurs during the creation of the secret. |
ApiException
|
unexpected error. |
Source code in src/zenml/integrations/seldon/seldon_client.py
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 |
|
delete_deployment(name: str, force: bool = False, poll_timeout: int = 0) -> None
Delete a Seldon Core deployment resource managed by ZenML.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
the name of the Seldon Core deployment resource to delete. |
required |
force
|
bool
|
if True, the deployment deletion will be forced (the graceful period will be set to zero). |
False
|
poll_timeout
|
int
|
the maximum time to wait for the deployment to be deleted. If set to 0, the function will return immediately without checking the deployment status. If a timeout occurs and the deployment still exists, this method will return and no exception will be raised. |
0
|
Raises:
Type | Description |
---|---|
SeldonClientError
|
if an unknown error occurs during the deployment removal. |
Source code in src/zenml/integrations/seldon/seldon_client.py
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 |
|
delete_secret(name: str) -> None
Delete a Kubernetes Secret resource managed by ZenML.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
the name of the Kubernetes Secret resource to delete. |
required |
Raises:
Type | Description |
---|---|
SeldonClientError
|
if an unknown error occurs during the removal of the secret. |
Source code in src/zenml/integrations/seldon/seldon_client.py
1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 |
|
find_deployments(name: Optional[str] = None, labels: Optional[Dict[str, str]] = None, fields: Optional[Dict[str, str]] = None) -> List[SeldonDeployment]
Find all ZenML-managed Seldon Core deployment resources matching the given criteria.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
Optional[str]
|
optional name of the deployment resource to find. |
None
|
fields
|
Optional[Dict[str, str]]
|
optional selector to restrict the list of returned Seldon deployments by their fields. Defaults to everything. |
None
|
labels
|
Optional[Dict[str, str]]
|
optional selector to restrict the list of returned Seldon deployments by their labels. Defaults to everything. |
None
|
Returns:
Type | Description |
---|---|
List[SeldonDeployment]
|
List of Seldon Core deployments that match the given criteria. |
Raises:
Type | Description |
---|---|
SeldonClientError
|
if an unknown error occurs while fetching the deployments. |
Source code in src/zenml/integrations/seldon/seldon_client.py
857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 |
|
get_deployment(name: str) -> SeldonDeployment
Get a ZenML managed Seldon Core deployment resource by name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
the name of the Seldon Core deployment resource to fetch. |
required |
Returns:
Type | Description |
---|---|
SeldonDeployment
|
The Seldon Core deployment resource. |
Raises:
Type | Description |
---|---|
SeldonDeploymentNotFoundError
|
if the deployment resource cannot be found or is not managed by ZenML. |
SeldonClientError
|
if an unknown error occurs while fetching the deployment. |
Source code in src/zenml/integrations/seldon/seldon_client.py
797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 |
|
get_deployment_logs(name: str, follow: bool = False, tail: Optional[int] = None) -> Generator[str, bool, None]
Get the logs of a Seldon Core deployment resource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
the name of the Seldon Core deployment to get logs for. |
required |
follow
|
bool
|
if True, the logs will be streamed as they are written |
False
|
tail
|
Optional[int]
|
only retrieve the last NUM lines of log output. |
None
|
Returns:
Type | Description |
---|---|
None
|
A generator that can be accessed to get the service logs. |
Yields:
Type | Description |
---|---|
str
|
The next log line. |
Raises:
Type | Description |
---|---|
SeldonClientError
|
if an unknown error occurs while fetching the logs. |
Source code in src/zenml/integrations/seldon/seldon_client.py
931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 |
|
sanitize_labels(labels: Dict[str, str]) -> None
staticmethod
Update the label values to be valid Kubernetes labels.
See: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set
Parameters:
Name | Type | Description | Default |
---|---|---|---|
labels
|
Dict[str, str]
|
the labels to sanitize. |
required |
Source code in src/zenml/integrations/seldon/seldon_client.py
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 |
|
update_deployment(deployment: SeldonDeployment, poll_timeout: int = 0) -> SeldonDeployment
Update a Seldon Core deployment resource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
SeldonDeployment
|
the Seldon Core deployment resource to update |
required |
poll_timeout
|
int
|
the maximum time to wait for the deployment to become available or to fail. If set to 0, the function will return immediately without checking the deployment status. If a timeout occurs and the deployment is still pending creation, it will be returned anyway and no exception will be raised. |
0
|
Returns:
Type | Description |
---|---|
SeldonDeployment
|
the updated Seldon Core deployment resource with updated status. |
Raises:
Type | Description |
---|---|
SeldonClientError
|
if an unknown error occurs while updating the deployment. |
Source code in src/zenml/integrations/seldon/seldon_client.py
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 |
|
SeldonClientError
Bases: Exception
Base exception class for all exceptions raised by the SeldonClient.
SeldonClientTimeout
Bases: SeldonClientError
Raised when the Seldon client timed out while waiting for a resource to reach the expected status.
SeldonDeployment
Bases: BaseModel
A Seldon Core deployment CRD.
This is a Pydantic representation of some of the fields in the Seldon Core CRD (documented here: https://docs.seldon.io/projects/seldon-core/en/latest/reference/seldon-deployment.html).
Note that not all fields are represented, only those that are relevant to the ZenML integration. The fields that are not represented are silently ignored when the Seldon Deployment is created or updated from an external SeldonDeployment CRD representation.
Attributes:
Name | Type | Description |
---|---|---|
kind |
Literal['SeldonDeployment']
|
Kubernetes kind field. |
apiVersion |
Literal['machinelearning.seldon.io/v1']
|
Kubernetes apiVersion field. |
metadata |
SeldonDeploymentMetadata
|
Kubernetes metadata field. |
spec |
SeldonDeploymentSpec
|
Seldon Deployment spec entry. |
status |
Optional[SeldonDeploymentStatus]
|
Seldon Deployment status. |
name: str
property
Returns the name of this Seldon Deployment.
This is just a shortcut for self.metadata.name
.
Returns:
Type | Description |
---|---|
str
|
The name of this Seldon Deployment. |
state: SeldonDeploymentStatusState
property
The state of the Seldon Deployment.
Returns:
Type | Description |
---|---|
SeldonDeploymentStatusState
|
The state of the Seldon Deployment. |
build(name: Optional[str] = None, model_uri: Optional[str] = None, model_name: Optional[str] = None, implementation: Optional[str] = None, parameters: Optional[List[SeldonDeploymentPredictorParameter]] = None, engineResources: Optional[SeldonResourceRequirements] = None, secret_name: Optional[str] = None, labels: Optional[Dict[str, str]] = None, annotations: Optional[Dict[str, str]] = None, is_custom_deployment: Optional[bool] = False, spec: Optional[Dict[Any, Any]] = None, serviceAccountName: Optional[str] = None) -> SeldonDeployment
classmethod
Build a basic Seldon Deployment object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
Optional[str]
|
The name of the Seldon Deployment. If not explicitly passed, a unique name is autogenerated. |
None
|
model_uri
|
Optional[str]
|
The URI of the model. |
None
|
model_name
|
Optional[str]
|
The name of the model. |
None
|
implementation
|
Optional[str]
|
The implementation of the model. |
None
|
parameters
|
Optional[List[SeldonDeploymentPredictorParameter]]
|
The predictor graph parameters. |
None
|
engineResources
|
Optional[SeldonResourceRequirements]
|
The resources to be allocated to the model. |
None
|
secret_name
|
Optional[str]
|
The name of the Kubernetes secret containing environment variable values (e.g. with credentials for the artifact store) to use with the deployment service. |
None
|
labels
|
Optional[Dict[str, str]]
|
A dictionary of labels to apply to the Seldon Deployment. |
None
|
annotations
|
Optional[Dict[str, str]]
|
A dictionary of annotations to apply to the Seldon Deployment. |
None
|
spec
|
Optional[Dict[Any, Any]]
|
A Kubernetes pod spec to use for the Seldon Deployment. |
None
|
is_custom_deployment
|
Optional[bool]
|
Whether the Seldon Deployment is a custom or a built-in one. |
False
|
serviceAccountName
|
Optional[str]
|
The name of the service account to associate with the predictive unit container. |
None
|
Returns:
Type | Description |
---|---|
SeldonDeployment
|
A minimal SeldonDeployment object built from the provided |
SeldonDeployment
|
parameters. |
Source code in src/zenml/integrations/seldon/seldon_client.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
get_error() -> Optional[str]
Get a message describing the error, if in an error state.
Returns:
Type | Description |
---|---|
Optional[str]
|
A message describing the error, if in an error state, otherwise |
Optional[str]
|
None. |
Source code in src/zenml/integrations/seldon/seldon_client.py
455 456 457 458 459 460 461 462 463 464 |
|
get_pending_message() -> Optional[str]
Get a message describing the pending conditions of the Seldon Deployment.
Returns:
Type | Description |
---|---|
Optional[str]
|
A message describing the pending condition of the Seldon |
Optional[str]
|
Deployment, or None, if no conditions are pending. |
Source code in src/zenml/integrations/seldon/seldon_client.py
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 |
|
is_available() -> bool
Checks if the Seldon Deployment is in an available state.
Returns:
Type | Description |
---|---|
bool
|
True if the Seldon Deployment is available, False otherwise. |
Source code in src/zenml/integrations/seldon/seldon_client.py
439 440 441 442 443 444 445 |
|
is_failed() -> bool
Checks if the Seldon Deployment is in a failed state.
Returns:
Type | Description |
---|---|
bool
|
True if the Seldon Deployment is failed, False otherwise. |
Source code in src/zenml/integrations/seldon/seldon_client.py
447 448 449 450 451 452 453 |
|
is_managed_by_zenml() -> bool
Checks if this Seldon Deployment is managed by ZenML.
The convention used to differentiate between SeldonDeployment instances
that are managed by ZenML and those that are not is to set the app
label value to zenml
.
Returns:
Type | Description |
---|---|
bool
|
True if the Seldon Deployment is managed by ZenML, False |
bool
|
otherwise. |
Source code in src/zenml/integrations/seldon/seldon_client.py
387 388 389 390 391 392 393 394 395 396 397 398 |
|
is_pending() -> bool
Checks if the Seldon Deployment is in a pending state.
Returns:
Type | Description |
---|---|
bool
|
True if the Seldon Deployment is pending, False otherwise. |
Source code in src/zenml/integrations/seldon/seldon_client.py
431 432 433 434 435 436 437 |
|
mark_as_managed_by_zenml() -> None
Marks this Seldon Deployment as managed by ZenML.
The convention used to differentiate between SeldonDeployment instances
that are managed by ZenML and those that are not is to set the app
label value to zenml
.
Source code in src/zenml/integrations/seldon/seldon_client.py
400 401 402 403 404 405 406 407 |
|
SeldonDeploymentComponentSpecs
Bases: BaseModel
Component specs for a Seldon Deployment.
Attributes:
Name | Type | Description |
---|---|---|
spec |
Optional[Dict[str, Any]]
|
the component spec. |
SeldonDeploymentExistsError
Bases: SeldonClientError
Raised when a SeldonDeployment resource cannot be created because a resource with the same name already exists.
SeldonDeploymentMetadata
Bases: BaseModel
Metadata for a Seldon Deployment.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
the name of the Seldon Deployment. |
labels |
Dict[str, str]
|
Kubernetes labels for the Seldon Deployment. |
annotations |
Dict[str, str]
|
Kubernetes annotations for the Seldon Deployment. |
creationTimestamp |
Optional[str]
|
the creation timestamp of the Seldon Deployment. |
SeldonDeploymentNotFoundError
Bases: SeldonClientError
Raised when a particular SeldonDeployment resource is not found or is not managed by ZenML.
SeldonDeploymentPredictiveUnit
Bases: BaseModel
Seldon Deployment predictive unit.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
the name of the predictive unit. |
type |
Optional[SeldonDeploymentPredictiveUnitType]
|
predictive unit type. |
implementation |
Optional[str]
|
the Seldon Core implementation used to serve the model. |
modelUri |
Optional[str]
|
URI of the model (or models) to serve. |
serviceAccountName |
Optional[str]
|
the name of the service account to associate with the predictive unit container. |
envSecretRefName |
Optional[str]
|
the name of a Kubernetes secret that contains environment variables (e.g. credentials) to be configured for the predictive unit container. |
children |
Optional[List[SeldonDeploymentPredictiveUnit]]
|
a list of child predictive units that together make up the model serving graph. |
SeldonDeploymentPredictiveUnitType
SeldonDeploymentPredictor
Bases: BaseModel
Seldon Deployment predictor.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
the name of the predictor. |
replicas |
int
|
the number of pod replicas for the predictor. |
graph |
SeldonDeploymentPredictiveUnit
|
the serving graph composed of one or more predictive units. |
SeldonDeploymentPredictorParameter
Bases: BaseModel
Parameter for Seldon Deployment predictor.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
parameter name |
type |
str
|
parameter, can be INT, FLOAT, DOUBLE, STRING, BOOL |
value |
str
|
parameter value |
SeldonDeploymentSpec
Bases: BaseModel
Spec for a Seldon Deployment.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
the name of the Seldon Deployment. |
protocol |
Optional[str]
|
the API protocol used for the Seldon Deployment. |
predictors |
List[SeldonDeploymentPredictor]
|
a list of predictors that make up the serving graph. |
replicas |
int
|
the default number of pod replicas used for the predictors. |
SeldonDeploymentStatus
Bases: BaseModel
The status of a Seldon Deployment.
Attributes:
Name | Type | Description |
---|---|---|
state |
SeldonDeploymentStatusState
|
the current state of the Seldon Deployment. |
description |
Optional[str]
|
a human-readable description of the current state. |
replicas |
Optional[int]
|
the current number of running pod replicas |
address |
Optional[SeldonDeploymentStatusAddress]
|
the address where the Seldon Deployment API can be accessed. |
conditions |
List[SeldonDeploymentStatusCondition]
|
the list of Kubernetes conditions for the Seldon Deployment. |
SeldonDeploymentStatusAddress
Bases: BaseModel
The status address for a Seldon Deployment.
Attributes:
Name | Type | Description |
---|---|---|
url |
str
|
the URL where the Seldon Deployment API can be accessed internally. |
SeldonDeploymentStatusCondition
Bases: BaseModel
The Kubernetes status condition entry for a Seldon Deployment.
Attributes:
Name | Type | Description |
---|---|---|
type |
str
|
Type of runtime condition. |
status |
bool
|
Status of the condition. |
reason |
Optional[str]
|
Brief CamelCase string containing reason for the condition's last transition. |
message |
Optional[str]
|
Human-readable message indicating details about last transition. |
SeldonDeploymentStatusState
SeldonResourceRequirements
Bases: BaseModel
Resource requirements for a Seldon deployed model.
Attributes:
Name | Type | Description |
---|---|---|
limits |
Dict[str, str]
|
an upper limit of resources to be used by the model |
requests |
Dict[str, str]
|
resources requested by the model |
Functions
create_seldon_core_custom_spec(model_uri: Optional[str], custom_docker_image: Optional[str], secret_name: Optional[str], command: Optional[List[str]], container_registry_secret_name: Optional[str] = None) -> k8s_client.V1PodSpec
Create a custom pod spec for the seldon core container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_uri
|
Optional[str]
|
The URI of the model to load. |
required |
custom_docker_image
|
Optional[str]
|
The docker image to use. |
required |
secret_name
|
Optional[str]
|
The name of the Kubernetes secret to use. |
required |
command
|
Optional[List[str]]
|
The command to run in the container. |
required |
container_registry_secret_name
|
Optional[str]
|
The name of the secret to use for docker image pull. |
None
|
Returns:
Type | Description |
---|---|
V1PodSpec
|
A pod spec for the seldon core container. |
Source code in src/zenml/integrations/seldon/seldon_client.py
1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 |
|
services
Initialization for Seldon services.
Classes
Modules
seldon_deployment
Implementation for the Seldon Deployment step.
SeldonDeploymentConfig(**data: Any)
Bases: ServiceConfig
Seldon Core deployment service configuration.
Attributes:
Name | Type | Description |
---|---|---|
model_uri |
str
|
URI of the model (or models) to serve. |
model_name |
str
|
the name of the model. Multiple versions of the same model should use the same model name. |
implementation |
str
|
the Seldon Core implementation used to serve the model.
The implementation type can be one of the following: |
replicas |
int
|
number of replicas to use for the prediction service. |
secret_name |
Optional[str]
|
the name of a Kubernetes secret containing additional configuration parameters for the Seldon Core deployment (e.g. credentials to access the Artifact Store). |
model_metadata |
Dict[str, Any]
|
optional model metadata information (see https://docs.seldon.io/projects/seldon-core/en/latest/reference/apis/metadata.html). |
extra_args |
Dict[str, Any]
|
additional arguments to pass to the Seldon Core deployment resource configuration. |
is_custom_deployment |
Optional[bool]
|
whether the deployment is a custom deployment |
spec |
Optional[Dict[Any, Any]]
|
custom Kubernetes resource specification for the Seldon Core |
serviceAccountName |
Optional[str]
|
The name of the Service Account applied to the deployment. |
Source code in src/zenml/services/service.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
create_from_deployment(deployment: SeldonDeployment) -> SeldonDeploymentConfig
classmethod
Recreate the configuration of a Seldon Core Service from a deployed instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
SeldonDeployment
|
the Seldon Core deployment resource. |
required |
Returns:
Type | Description |
---|---|
SeldonDeploymentConfig
|
The Seldon Core service configuration corresponding to the given |
SeldonDeploymentConfig
|
Seldon Core deployment resource. |
Raises:
Type | Description |
---|---|
ValueError
|
if the given deployment resource does not contain the expected annotations, or it contains an invalid or incompatible Seldon Core service configuration. |
Source code in src/zenml/integrations/seldon/services/seldon_deployment.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
get_seldon_deployment_annotations() -> Dict[str, str]
Generate annotations for the Seldon Core deployment from the service configuration.
The annotations are used to store additional information about the Seldon Core service that is associated with the deployment that is not available in the labels. One annotation particularly important is the serialized Service configuration itself, which is used to recreate the service configuration from a remote Seldon deployment.
Returns:
Type | Description |
---|---|
Dict[str, str]
|
The annotations for the Seldon Core deployment. |
Source code in src/zenml/integrations/seldon/services/seldon_deployment.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
get_seldon_deployment_labels() -> Dict[str, str]
Generate labels for the Seldon Core deployment from the service configuration.
These labels are attached to the Seldon Core deployment resource and may be used as label selectors in lookup operations.
Returns:
Type | Description |
---|---|
Dict[str, str]
|
The labels for the Seldon Core deployment. |
Source code in src/zenml/integrations/seldon/services/seldon_deployment.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
SeldonDeploymentService(**attrs: Any)
Bases: BaseDeploymentService
A service that represents a Seldon Core deployment server.
Attributes:
Name | Type | Description |
---|---|---|
config |
SeldonDeploymentConfig
|
service configuration. |
status |
SeldonDeploymentServiceStatus
|
service status. |
Source code in src/zenml/services/service.py
188 189 190 191 192 193 194 195 196 197 198 |
|
prediction_url: Optional[str]
property
The prediction URI exposed by the prediction service.
Returns:
Type | Description |
---|---|
Optional[str]
|
The prediction URI exposed by the prediction service, or None if |
Optional[str]
|
the service is not yet ready. |
seldon_deployment_name: str
property
Get the name of the Seldon Core deployment.
It should return the one that uniquely corresponds to this service instance.
Returns:
Type | Description |
---|---|
str
|
The name of the Seldon Core deployment. |
check_status() -> Tuple[ServiceState, str]
Check the the current operational state of the Seldon Core deployment.
Returns:
Type | Description |
---|---|
ServiceState
|
The operational state of the Seldon Core deployment and a message |
str
|
providing additional information about that state (e.g. a |
Tuple[ServiceState, str]
|
description of the error, if one is encountered). |
Source code in src/zenml/integrations/seldon/services/seldon_deployment.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
|
create_from_deployment(deployment: SeldonDeployment) -> SeldonDeploymentService
classmethod
Recreate a Seldon Core service from a Seldon Core deployment resource.
It should then update their operational status.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
SeldonDeployment
|
the Seldon Core deployment resource. |
required |
Returns:
Type | Description |
---|---|
SeldonDeploymentService
|
The Seldon Core service corresponding to the given |
SeldonDeploymentService
|
Seldon Core deployment resource. |
Raises:
Type | Description |
---|---|
ValueError
|
if the given deployment resource does not contain the expected service_uuid label. |
Source code in src/zenml/integrations/seldon/services/seldon_deployment.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
|
deprovision(force: bool = False) -> None
Deprovision the remote Seldon Core deployment instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
force
|
bool
|
if True, the remote deployment instance will be forcefully deprovisioned. |
False
|
Source code in src/zenml/integrations/seldon/services/seldon_deployment.py
321 322 323 324 325 326 327 328 329 330 331 332 333 |
|
get_logs(follow: bool = False, tail: Optional[int] = None) -> Generator[str, bool, None]
Get the logs of a Seldon Core model deployment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
follow
|
bool
|
if True, the logs will be streamed as they are written |
False
|
tail
|
Optional[int]
|
only retrieve the last NUM lines of log output. |
None
|
Returns:
Type | Description |
---|---|
None
|
A generator that can be accessed to get the service logs. |
Source code in src/zenml/integrations/seldon/services/seldon_deployment.py
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
|
predict(request: str) -> Any
Make a prediction using the service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
str
|
a numpy array representing the request |
required |
Returns:
Type | Description |
---|---|
Any
|
A numpy array representing the prediction returned by the service. |
Raises:
Type | Description |
---|---|
Exception
|
if the service is not yet ready. |
ValueError
|
if the prediction_url is not set. |
Source code in src/zenml/integrations/seldon/services/seldon_deployment.py
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
provision() -> None
Provision or update remote Seldon Core deployment instance.
This should then match the current configuration.
Source code in src/zenml/integrations/seldon/services/seldon_deployment.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
|
SeldonDeploymentServiceStatus
steps
Initialization for Seldon steps.
Functions
Modules
seldon_deployer
Implementation of the Seldon Deployer step.
seldon_custom_model_deployer_step(model: UnmaterializedArtifact, predict_function: str, service_config: SeldonDeploymentConfig, deploy_decision: bool = True, timeout: int = DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT) -> SeldonDeploymentService
Seldon Core custom model deployer pipeline step.
This step can be used in a pipeline to implement the the process required to deploy a custom model with Seldon Core.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
UnmaterializedArtifact
|
the model artifact to deploy |
required |
predict_function
|
str
|
Path to Python file containing predict function. |
required |
service_config
|
SeldonDeploymentConfig
|
Seldon Core deployment service configuration. |
required |
deploy_decision
|
bool
|
whether to deploy the model or not |
True
|
timeout
|
int
|
the timeout in seconds to wait for the deployment to start |
DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT
|
Raises:
Type | Description |
---|---|
ValueError
|
if the custom deployer is not defined |
ValueError
|
if predict function path is not valid |
TypeError
|
if predict function path is not a callable function |
DoesNotExistException
|
if an entity does not exist raise an exception |
RuntimeError
|
if the build is missing for the pipeline run |
Returns:
Type | Description |
---|---|
SeldonDeploymentService
|
Seldon Core deployment service |
Source code in src/zenml/integrations/seldon/steps/seldon_deployer.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
|
seldon_mlflow_registry_deployer_step(service_config: SeldonDeploymentConfig, registry_model_name: Optional[str] = None, registry_model_version: Optional[str] = None, registry_model_stage: Optional[ModelVersionStage] = None, replace_existing: bool = True, timeout: int = DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT) -> SeldonDeploymentService
Seldon Core model deployer pipeline step.
This step can be used in a pipeline to implement continuous deployment for a MLflow model with Seldon Core.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_config
|
SeldonDeploymentConfig
|
Seldon Core deployment service configuration |
required |
registry_model_name
|
Optional[str]
|
name of the model in the model registry |
None
|
registry_model_version
|
Optional[str]
|
version of the model in the model registry |
None
|
registry_model_stage
|
Optional[ModelVersionStage]
|
stage of the model in the model registry |
None
|
replace_existing
|
bool
|
whether to replace an existing deployment of the model with the same name, this is used only when the model is deployed from a model registry stored model. |
True
|
timeout
|
int
|
the timeout in seconds to wait for the deployment to start |
DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT
|
Returns:
Type | Description |
---|---|
SeldonDeploymentService
|
Seldon Core deployment service |
Raises:
Type | Description |
---|---|
ValueError
|
if registry_model_name is not provided |
ValueError
|
if neither registry_model_version nor registry_model_stage is provided |
ValueError
|
if the MLflow experiment tracker is not available in the active stack |
LookupError
|
if no model version is found in the MLflow model registry. |
Source code in src/zenml/integrations/seldon/steps/seldon_deployer.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 |
|
seldon_model_deployer_step(model: UnmaterializedArtifact, service_config: SeldonDeploymentConfig, deploy_decision: bool = True, timeout: int = DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT) -> SeldonDeploymentService
Seldon Core model deployer pipeline step.
This step can be used in a pipeline to implement continuous deployment for a ML model with Seldon Core.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
UnmaterializedArtifact
|
the model artifact to deploy |
required |
service_config
|
SeldonDeploymentConfig
|
Seldon Core deployment service configuration. |
required |
deploy_decision
|
bool
|
whether to deploy the model or not |
True
|
timeout
|
int
|
the timeout in seconds to wait for the deployment to start |
DEFAULT_SELDON_DEPLOYMENT_START_STOP_TIMEOUT
|
Returns:
Type | Description |
---|---|
SeldonDeploymentService
|
Seldon Core deployment service |
Source code in src/zenml/integrations/seldon/steps/seldon_deployer.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|