Databricks
zenml.integrations.databricks
Initialization of the Databricks integration for ZenML.
Attributes
DATABRICKS = 'databricks'
module-attribute
DATABRICKS_MODEL_DEPLOYER_FLAVOR = 'databricks'
module-attribute
DATABRICKS_ORCHESTRATOR_FLAVOR = 'databricks'
module-attribute
DATABRICKS_SERVICE_ARTIFACT = 'databricks_deployment_service'
module-attribute
DATABRICKS_STEP_OPERATOR_FLAVOR = 'databricks'
module-attribute
Classes
DatabricksIntegration
Bases: Integration
Definition of Databricks Integration for ZenML.
Functions
flavors() -> List[Type[Flavor]]
classmethod
Declare the stack component flavors for the Databricks integration.
Returns:
| Type | Description |
|---|---|
List[Type[Flavor]]
|
List of stack component flavors for this integration. |
Source code in src/zenml/integrations/databricks/__init__.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
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/databricks/__init__.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
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. |
display_name: Optional[str]
property
The display name of the flavor.
By default, converts the technical name to a human-readable format. For example, "vm_kubernetes" becomes "VM Kubernetes". Flavors can override this to provide custom display names.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The display name of the flavor. |
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
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 | |
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
219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
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
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 | |
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
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 205 206 207 208 209 210 211 212 213 214 215 216 217 | |
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
136 137 138 | |
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
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 | |
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
140 141 142 143 144 145 146 147 | |
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
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
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
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
Modules
flavors
Databricks integration flavors.
Classes
DatabricksAccessControlRequest
Bases: BaseModel
Databricks job access control entry.
DatabricksAvailabilityType
DatabricksModelDeployerConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseModelDeployerConfig
Configuration for the Databricks model deployer.
Attributes:
| Name | Type | Description |
|---|---|---|
host |
str
|
Databricks host. |
secret_name |
Optional[str]
|
Secret name to use for authentication. |
client_id |
Optional[str]
|
Databricks client id. |
client_secret |
Optional[str]
|
Databricks client secret. |
Source code in src/zenml/stack/stack_component.py
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 | |
DatabricksModelDeployerFlavor
Bases: BaseModelDeployerFlavor
Databricks Endpoint model deployer flavor.
config_class: Type[DatabricksModelDeployerConfig]
property
Returns DatabricksModelDeployerConfig config class.
Returns:
| Type | Description |
|---|---|
Type[DatabricksModelDeployerConfig]
|
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[DatabricksModelDeployer]
property
Implementation class for this flavor.
Returns:
| Type | Description |
|---|---|
Type[DatabricksModelDeployer]
|
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. |
DatabricksOrchestratorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseOrchestratorConfig, DatabricksOrchestratorSettings
Databricks orchestrator base config.
Attributes:
| Name | Type | Description |
|---|---|---|
host |
str
|
Databricks host. |
client_id |
Optional[str]
|
Databricks client id. |
client_secret |
Optional[str]
|
Databricks client secret. |
Source code in src/zenml/stack/stack_component.py
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 | |
is_local: bool
property
Checks if this stack component is running locally.
Returns:
| Type | Description |
|---|---|
bool
|
True if this config is for a local component, False otherwise. |
is_remote: bool
property
Checks if this stack component is running remotely.
Returns:
| Type | Description |
|---|---|
bool
|
True if this config is for a remote component, False otherwise. |
is_schedulable: bool
property
Whether the orchestrator is schedulable or not.
Returns:
| Type | Description |
|---|---|
bool
|
Whether the orchestrator is schedulable or not. |
DatabricksOrchestratorFlavor
Bases: BaseOrchestratorFlavor
Databricks orchestrator flavor.
config_class: Type[DatabricksOrchestratorConfig]
property
Returns DatabricksOrchestratorConfig config class.
Returns:
| Type | Description |
|---|---|
Type[DatabricksOrchestratorConfig]
|
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[DatabricksOrchestrator]
property
Implementation class for this flavor.
Returns:
| Type | Description |
|---|---|
Type[DatabricksOrchestrator]
|
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. |
DatabricksOrchestratorSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: DatabricksBaseSettings
Databricks orchestrator settings.
Source code in src/zenml/config/secret_reference_mixin.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 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 | |
DatabricksPermissionLevel
DatabricksStepOperatorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseStepOperatorConfig, DatabricksStepOperatorSettings
Databricks step operator config.
Source code in src/zenml/stack/stack_component.py
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 | |
is_local: bool
property
Checks if this stack component is running locally.
Returns:
| Type | Description |
|---|---|
bool
|
False, because the Databricks step operator always runs remotely. |
is_remote: bool
property
Checks if this stack component is running remotely.
Returns:
| Type | Description |
|---|---|
bool
|
True, because the Databricks step operator always runs remotely. |
DatabricksStepOperatorFlavor
Bases: BaseStepOperatorFlavor
Databricks step operator flavor.
config_class: Type[DatabricksStepOperatorConfig]
property
Returns DatabricksStepOperatorConfig config class.
Returns:
| Type | Description |
|---|---|
Type[DatabricksStepOperatorConfig]
|
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[DatabricksStepOperator]
property
Implementation class for this flavor.
Returns:
| Type | Description |
|---|---|
Type[DatabricksStepOperator]
|
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. |
DatabricksStepOperatorSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: DatabricksBaseSettings
Databricks step operator settings.
Source code in src/zenml/config/secret_reference_mixin.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 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 | |
Modules
databricks_model_deployer_flavor
Databricks model deployer flavor.
DatabricksBaseConfig
Bases: BaseModel
Databricks Inference Endpoint configuration.
DatabricksModelDeployerConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseModelDeployerConfig
Configuration for the Databricks model deployer.
Attributes:
| Name | Type | Description |
|---|---|---|
host |
str
|
Databricks host. |
secret_name |
Optional[str]
|
Secret name to use for authentication. |
client_id |
Optional[str]
|
Databricks client id. |
client_secret |
Optional[str]
|
Databricks client secret. |
Source code in src/zenml/stack/stack_component.py
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 | |
DatabricksModelDeployerFlavor
Bases: BaseModelDeployerFlavor
Databricks Endpoint model deployer flavor.
config_class: Type[DatabricksModelDeployerConfig]
property
Returns DatabricksModelDeployerConfig config class.
Returns:
| Type | Description |
|---|---|
Type[DatabricksModelDeployerConfig]
|
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[DatabricksModelDeployer]
property
Implementation class for this flavor.
Returns:
| Type | Description |
|---|---|
Type[DatabricksModelDeployer]
|
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. |
databricks_orchestrator_flavor
Databricks orchestrator base config and settings.
DatabricksOrchestratorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseOrchestratorConfig, DatabricksOrchestratorSettings
Databricks orchestrator base config.
Attributes:
| Name | Type | Description |
|---|---|---|
host |
str
|
Databricks host. |
client_id |
Optional[str]
|
Databricks client id. |
client_secret |
Optional[str]
|
Databricks client secret. |
Source code in src/zenml/stack/stack_component.py
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 | |
is_local: bool
property
Checks if this stack component is running locally.
Returns:
| Type | Description |
|---|---|
bool
|
True if this config is for a local component, False otherwise. |
is_remote: bool
property
Checks if this stack component is running remotely.
Returns:
| Type | Description |
|---|---|
bool
|
True if this config is for a remote component, False otherwise. |
is_schedulable: bool
property
Whether the orchestrator is schedulable or not.
Returns:
| Type | Description |
|---|---|
bool
|
Whether the orchestrator is schedulable or not. |
DatabricksOrchestratorFlavor
Bases: BaseOrchestratorFlavor
Databricks orchestrator flavor.
config_class: Type[DatabricksOrchestratorConfig]
property
Returns DatabricksOrchestratorConfig config class.
Returns:
| Type | Description |
|---|---|
Type[DatabricksOrchestratorConfig]
|
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[DatabricksOrchestrator]
property
Implementation class for this flavor.
Returns:
| Type | Description |
|---|---|
Type[DatabricksOrchestrator]
|
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. |
DatabricksOrchestratorSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: DatabricksBaseSettings
Databricks orchestrator settings.
Source code in src/zenml/config/secret_reference_mixin.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 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 | |
databricks_shared_settings
Shared Databricks settings models.
DatabricksAccessControlRequest
Bases: BaseModel
Databricks job access control entry.
DatabricksAvailabilityType
DatabricksBaseSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseSettings
Databricks execution settings shared by orchestrator and step operator.
Source code in src/zenml/config/secret_reference_mixin.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 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 | |
DatabricksPermissionLevel
databricks_step_operator_flavor
Databricks step operator flavor.
DatabricksStepOperatorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseStepOperatorConfig, DatabricksStepOperatorSettings
Databricks step operator config.
Source code in src/zenml/stack/stack_component.py
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 | |
is_local: bool
property
Checks if this stack component is running locally.
Returns:
| Type | Description |
|---|---|
bool
|
False, because the Databricks step operator always runs remotely. |
is_remote: bool
property
Checks if this stack component is running remotely.
Returns:
| Type | Description |
|---|---|
bool
|
True, because the Databricks step operator always runs remotely. |
DatabricksStepOperatorFlavor
Bases: BaseStepOperatorFlavor
Databricks step operator flavor.
config_class: Type[DatabricksStepOperatorConfig]
property
Returns DatabricksStepOperatorConfig config class.
Returns:
| Type | Description |
|---|---|
Type[DatabricksStepOperatorConfig]
|
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[DatabricksStepOperator]
property
Implementation class for this flavor.
Returns:
| Type | Description |
|---|---|
Type[DatabricksStepOperator]
|
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. |
DatabricksStepOperatorSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: DatabricksBaseSettings
Databricks step operator settings.
Source code in src/zenml/config/secret_reference_mixin.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 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 | |
model_deployers
Initialization of the Databricks model deployers.
Classes
DatabricksModelDeployer(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, environment: Optional[Dict[str, str]] = None, secrets: Optional[List[UUID]] = None, 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
Databricks endpoint model deployer.
Source code in src/zenml/stack/stack_component.py
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 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
config: DatabricksModelDeployerConfig
property
Config class for the Databricks Model deployer settings class.
Returns:
| Type | Description |
|---|---|
DatabricksModelDeployerConfig
|
The configuration. |
validator: Optional[StackValidator]
property
Validates the stack.
Returns:
| Type | Description |
|---|---|
Optional[StackValidator]
|
A validator that checks that the stack contains a remote artifact |
Optional[StackValidator]
|
store. |
get_model_server_info(service_instance: DatabricksDeploymentService) -> Dict[str, Optional[str]]
staticmethod
Return implementation specific information that might be relevant to the user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service_instance
|
DatabricksDeploymentService
|
Instance of a DatabricksDeploymentService |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Optional[str]]
|
Model server information. |
Source code in src/zenml/integrations/databricks/model_deployers/databricks_model_deployer.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
perform_delete_model(service: BaseService, timeout: int = DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT, force: bool = False) -> None
Method to delete all configuration of a model 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. |
DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT
|
force
|
bool
|
If True, force the service to stop. |
False
|
Source code in src/zenml/integrations/databricks/model_deployers/databricks_model_deployer.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
perform_deploy_model(id: UUID, config: ServiceConfig, timeout: int = DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT) -> BaseService
Create a new Databricks deployment service or update an existing one.
This should serve the supplied model and deployment configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
the UUID of the model to be deployed with Databricks. |
required |
config
|
ServiceConfig
|
the configuration of the model to be deployed with Databricks. |
required |
timeout
|
int
|
the timeout in seconds to wait for the Databricks endpoint to be provisioned and successfully started or updated. If set to 0, the method will return immediately after the Databricks server is provisioned, without waiting for it to fully start. |
DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT
|
Returns:
| Type | Description |
|---|---|
BaseService
|
The ZenML Databricks deployment service object that can be used to |
BaseService
|
interact with the remote Databricks inference endpoint server. |
Source code in src/zenml/integrations/databricks/model_deployers/databricks_model_deployer.py
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 | |
perform_start_model(service: BaseService, timeout: int = DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT) -> BaseService
Method to start a model server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service
|
BaseService
|
The service to start. |
required |
timeout
|
int
|
Timeout in seconds to wait for the service to start. |
DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT
|
Returns:
| Type | Description |
|---|---|
BaseService
|
The started service. |
Source code in src/zenml/integrations/databricks/model_deployers/databricks_model_deployer.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
perform_stop_model(service: BaseService, timeout: int = DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT, force: bool = False) -> BaseService
Method to stop a 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_DEPLOYMENT_START_STOP_TIMEOUT
|
force
|
bool
|
If True, force the service to stop. |
False
|
Returns:
| Type | Description |
|---|---|
BaseService
|
The stopped service. |
Source code in src/zenml/integrations/databricks/model_deployers/databricks_model_deployer.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
Modules
databricks_model_deployer
Implementation of the Databricks Model Deployer.
DatabricksModelDeployer(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, environment: Optional[Dict[str, str]] = None, secrets: Optional[List[UUID]] = None, 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
Databricks endpoint model deployer.
Source code in src/zenml/stack/stack_component.py
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 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
config: DatabricksModelDeployerConfig
property
Config class for the Databricks Model deployer settings class.
Returns:
| Type | Description |
|---|---|
DatabricksModelDeployerConfig
|
The configuration. |
validator: Optional[StackValidator]
property
Validates the stack.
Returns:
| Type | Description |
|---|---|
Optional[StackValidator]
|
A validator that checks that the stack contains a remote artifact |
Optional[StackValidator]
|
store. |
get_model_server_info(service_instance: DatabricksDeploymentService) -> Dict[str, Optional[str]]
staticmethod
Return implementation specific information that might be relevant to the user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service_instance
|
DatabricksDeploymentService
|
Instance of a DatabricksDeploymentService |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Optional[str]]
|
Model server information. |
Source code in src/zenml/integrations/databricks/model_deployers/databricks_model_deployer.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
perform_delete_model(service: BaseService, timeout: int = DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT, force: bool = False) -> None
Method to delete all configuration of a model 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. |
DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT
|
force
|
bool
|
If True, force the service to stop. |
False
|
Source code in src/zenml/integrations/databricks/model_deployers/databricks_model_deployer.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
perform_deploy_model(id: UUID, config: ServiceConfig, timeout: int = DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT) -> BaseService
Create a new Databricks deployment service or update an existing one.
This should serve the supplied model and deployment configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
the UUID of the model to be deployed with Databricks. |
required |
config
|
ServiceConfig
|
the configuration of the model to be deployed with Databricks. |
required |
timeout
|
int
|
the timeout in seconds to wait for the Databricks endpoint to be provisioned and successfully started or updated. If set to 0, the method will return immediately after the Databricks server is provisioned, without waiting for it to fully start. |
DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT
|
Returns:
| Type | Description |
|---|---|
BaseService
|
The ZenML Databricks deployment service object that can be used to |
BaseService
|
interact with the remote Databricks inference endpoint server. |
Source code in src/zenml/integrations/databricks/model_deployers/databricks_model_deployer.py
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 | |
perform_start_model(service: BaseService, timeout: int = DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT) -> BaseService
Method to start a model server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service
|
BaseService
|
The service to start. |
required |
timeout
|
int
|
Timeout in seconds to wait for the service to start. |
DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT
|
Returns:
| Type | Description |
|---|---|
BaseService
|
The started service. |
Source code in src/zenml/integrations/databricks/model_deployers/databricks_model_deployer.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
perform_stop_model(service: BaseService, timeout: int = DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT, force: bool = False) -> BaseService
Method to stop a 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_DEPLOYMENT_START_STOP_TIMEOUT
|
force
|
bool
|
If True, force the service to stop. |
False
|
Returns:
| Type | Description |
|---|---|
BaseService
|
The stopped service. |
Source code in src/zenml/integrations/databricks/model_deployers/databricks_model_deployer.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
orchestrators
Initialization of the Databricks ZenML orchestrator.
Classes
DatabricksOrchestrator(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, environment: Optional[Dict[str, str]] = None, secrets: Optional[List[UUID]] = None, 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: WheeledOrchestrator
Databricks orchestrator.
Source code in src/zenml/stack/stack_component.py
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 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
config: DatabricksOrchestratorConfig
property
Returns the DatabricksOrchestratorConfig config.
Returns:
| Type | Description |
|---|---|
DatabricksOrchestratorConfig
|
The configuration. |
settings_class: Type[DatabricksOrchestratorSettings]
property
Settings class for the Databricks orchestrator.
Returns:
| Type | Description |
|---|---|
Type[DatabricksOrchestratorSettings]
|
The settings class. |
validator: Optional[StackValidator]
property
Validates the stack.
Returns:
| Type | Description |
|---|---|
Optional[StackValidator]
|
A validator that rejects local stack components. |
get_orchestrator_run_id() -> str
Returns the active orchestrator run id.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the run id cannot be read from the environment. |
Returns:
| Type | Description |
|---|---|
str
|
The orchestrator run id. |
Source code in src/zenml/integrations/databricks/orchestrators/databricks_orchestrator.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
get_pipeline_run_metadata(run_id: UUID) -> Dict[str, MetadataType]
Get general component-specific metadata for a pipeline run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run_id
|
UUID
|
The ID of the pipeline run. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, MetadataType]
|
A dictionary of metadata. |
Source code in src/zenml/integrations/databricks/orchestrators/databricks_orchestrator.py
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | |
setup_credentials() -> None
Set up credentials for the orchestrator.
Source code in src/zenml/integrations/databricks/orchestrators/databricks_orchestrator.py
156 157 158 159 160 | |
submit_pipeline(snapshot: PipelineSnapshotResponse, stack: Stack, base_environment: Dict[str, str], step_environments: Dict[str, Dict[str, str]], placeholder_run: Optional[PipelineRunResponse] = None) -> Optional[SubmissionResult]
Submits a pipeline to the orchestrator.
This method should only submit the pipeline and not wait for it to complete. If the orchestrator is configured to wait for the pipeline run to complete, a function that waits for the pipeline run to complete can be passed as part of the submission result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
PipelineSnapshotResponse
|
The pipeline snapshot to submit. |
required |
stack
|
Stack
|
The stack the pipeline will run on. |
required |
base_environment
|
Dict[str, str]
|
Base environment shared by all Databricks tasks. |
required |
step_environments
|
Dict[str, Dict[str, str]]
|
Environment variables to set when executing specific steps. |
required |
placeholder_run
|
Optional[PipelineRunResponse]
|
An optional placeholder run for the snapshot. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the schedule is not set or if the cron expression is not set. |
Exception
|
If wheel upload or Databricks job submission fails after cleanup. |
Returns:
| Type | Description |
|---|---|
Optional[SubmissionResult]
|
Optional submission result. |
Source code in src/zenml/integrations/databricks/orchestrators/databricks_orchestrator.py
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 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 | |
Modules
databricks_orchestrator
Implementation of the Databricks orchestrator.
DatabricksOrchestrator(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, environment: Optional[Dict[str, str]] = None, secrets: Optional[List[UUID]] = None, 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: WheeledOrchestrator
Databricks orchestrator.
Source code in src/zenml/stack/stack_component.py
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 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
config: DatabricksOrchestratorConfig
property
Returns the DatabricksOrchestratorConfig config.
Returns:
| Type | Description |
|---|---|
DatabricksOrchestratorConfig
|
The configuration. |
settings_class: Type[DatabricksOrchestratorSettings]
property
Settings class for the Databricks orchestrator.
Returns:
| Type | Description |
|---|---|
Type[DatabricksOrchestratorSettings]
|
The settings class. |
validator: Optional[StackValidator]
property
Validates the stack.
Returns:
| Type | Description |
|---|---|
Optional[StackValidator]
|
A validator that rejects local stack components. |
get_orchestrator_run_id() -> str
Returns the active orchestrator run id.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the run id cannot be read from the environment. |
Returns:
| Type | Description |
|---|---|
str
|
The orchestrator run id. |
Source code in src/zenml/integrations/databricks/orchestrators/databricks_orchestrator.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
get_pipeline_run_metadata(run_id: UUID) -> Dict[str, MetadataType]
Get general component-specific metadata for a pipeline run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run_id
|
UUID
|
The ID of the pipeline run. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, MetadataType]
|
A dictionary of metadata. |
Source code in src/zenml/integrations/databricks/orchestrators/databricks_orchestrator.py
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | |
setup_credentials() -> None
Set up credentials for the orchestrator.
Source code in src/zenml/integrations/databricks/orchestrators/databricks_orchestrator.py
156 157 158 159 160 | |
submit_pipeline(snapshot: PipelineSnapshotResponse, stack: Stack, base_environment: Dict[str, str], step_environments: Dict[str, Dict[str, str]], placeholder_run: Optional[PipelineRunResponse] = None) -> Optional[SubmissionResult]
Submits a pipeline to the orchestrator.
This method should only submit the pipeline and not wait for it to complete. If the orchestrator is configured to wait for the pipeline run to complete, a function that waits for the pipeline run to complete can be passed as part of the submission result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
PipelineSnapshotResponse
|
The pipeline snapshot to submit. |
required |
stack
|
Stack
|
The stack the pipeline will run on. |
required |
base_environment
|
Dict[str, str]
|
Base environment shared by all Databricks tasks. |
required |
step_environments
|
Dict[str, Dict[str, str]]
|
Environment variables to set when executing specific steps. |
required |
placeholder_run
|
Optional[PipelineRunResponse]
|
An optional placeholder run for the snapshot. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the schedule is not set or if the cron expression is not set. |
Exception
|
If wheel upload or Databricks job submission fails after cleanup. |
Returns:
| Type | Description |
|---|---|
Optional[SubmissionResult]
|
Optional submission result. |
Source code in src/zenml/integrations/databricks/orchestrators/databricks_orchestrator.py
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 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 | |
databricks_orchestrator_entrypoint_config
Entrypoint configuration for ZenML Databricks pipeline steps.
DatabricksEntrypointConfiguration(arguments: List[str])
Bases: StepEntrypointConfiguration
Entrypoint configuration for ZenML Databricks pipeline steps.
Databricks job parameters are limited to 256 characters, so this configuration reconstructs long environment variables from shorter options.
Source code in src/zenml/entrypoints/base_entrypoint_configuration.py
61 62 63 64 65 66 67 68 | |
get_entrypoint_arguments(**kwargs: Any) -> List[str]
classmethod
Gets all arguments that the entrypoint command should be called with.
The argument list should be something that
argparse.ArgumentParser.parse_args(...) can handle (e.g.
["--some_option", "some_value"] or ["--some_option=some_value"]).
It needs to provide values for all options returned by the
get_entrypoint_options() method of this class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Kwargs, must include the step name. |
{}
|
Returns:
| Type | Description |
|---|---|
List[str]
|
The superclass arguments as well as arguments for the wheel package. |
Source code in src/zenml/integrations/databricks/orchestrators/databricks_orchestrator_entrypoint_config.py
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 | |
get_entrypoint_options() -> Dict[str, bool]
classmethod
Gets all options required for running with this configuration.
Returns:
| Type | Description |
|---|---|
Dict[str, bool]
|
The superclass options as well as an option for the wheel package. |
Source code in src/zenml/integrations/databricks/orchestrators/databricks_orchestrator_entrypoint_config.py
40 41 42 43 44 45 46 47 48 49 50 | |
run() -> None
Runs the step.
Source code in src/zenml/integrations/databricks/orchestrators/databricks_orchestrator_entrypoint_config.py
78 79 80 81 82 83 84 85 86 87 88 | |
services
Initialization of the Databricks Service.
Classes
Modules
databricks_deployment
Implementation of the Databricks Deployment service.
DatabricksDeploymentConfig(**data: Any)
Bases: DatabricksBaseConfig, ServiceConfig
Databricks service configurations.
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 | |
get_databricks_deployment_labels() -> Dict[str, str]
Generate labels for the Databricks deployment from the service configuration.
These labels are attached to the Databricks deployment resource and may be used as label selectors in lookup operations.
Returns:
| Type | Description |
|---|---|
Dict[str, str]
|
The labels for the Databricks deployment. |
Source code in src/zenml/integrations/databricks/services/databricks_deployment.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
DatabricksDeploymentService(config: DatabricksDeploymentConfig, **attrs: Any)
Bases: BaseDeploymentService
Databricks model deployment service.
Attributes:
| Name | Type | Description |
|---|---|---|
SERVICE_TYPE |
a service type descriptor with information describing the Databricks deployment service class |
|
config |
DatabricksDeploymentConfig
|
service configuration |
Initialize the Databricks deployment service.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
DatabricksDeploymentConfig
|
service configuration |
required |
attrs
|
Any
|
additional attributes to set on the service |
{}
|
Source code in src/zenml/integrations/databricks/services/databricks_deployment.py
113 114 115 116 117 118 119 120 | |
databricks_client: DatabricksClient
property
Get the deployed Databricks inference endpoint.
Returns:
| Type | Description |
|---|---|
WorkspaceClient
|
databricks inference endpoint. |
databricks_endpoint: ServingEndpointDetailed
property
Get the deployed Hugging Face inference endpoint.
Returns:
| Type | Description |
|---|---|
ServingEndpointDetailed
|
Databricks inference endpoint. |
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. |
check_status() -> Tuple[ServiceState, str]
Check the current operational state of the Databricks deployment.
Returns:
| Type | Description |
|---|---|
ServiceState
|
The operational state of the Databricks 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/databricks/services/databricks_deployment.py
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 | |
deprovision(force: bool = False) -> None
Deprovision the remote Databricks 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/databricks/services/databricks_deployment.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
get_client_id_and_secret() -> Tuple[str, str, str]
Get the Databricks client id and secret.
Raises:
| Type | Description |
|---|---|
ValueError
|
If client id and secret are not found. |
Returns:
| Type | Description |
|---|---|
Tuple[str, str, str]
|
Databricks client id and secret. |
Source code in src/zenml/integrations/databricks/services/databricks_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 157 158 159 160 | |
get_logs(follow: bool = False, tail: Optional[int] = None) -> Generator[str, bool, None]
Retrieve the service logs.
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
|
Yields:
| Type | Description |
|---|---|
str
|
A generator that can be accessed to get the service logs. |
Source code in src/zenml/integrations/databricks/services/databricks_deployment.py
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 | |
predict(request: Union[NDArray[Any], pd.DataFrame]) -> NDArray[Any]
Make a prediction using the service.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
Union[NDArray[Any], DataFrame]
|
The input data for the prediction. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[Any]
|
The prediction result. |
Raises:
| Type | Description |
|---|---|
Exception
|
if the service is not running |
ValueError
|
if the endpoint secret name is not provided. |
Source code in src/zenml/integrations/databricks/services/databricks_deployment.py
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 | |
provision() -> None
Provision or update remote Databricks deployment instance.
Source code in src/zenml/integrations/databricks/services/databricks_deployment.py
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 | |
DatabricksServiceStatus
step_operators
Initialization of the Databricks step operators.
Classes
DatabricksStepOperator(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, environment: Optional[Dict[str, str]] = None, secrets: Optional[List[UUID]] = None, 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: BaseStepOperator
Step operator to run individual steps on Databricks.
Source code in src/zenml/stack/stack_component.py
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 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
client: DatabricksClient
property
Get or create the Databricks client.
Returns:
| Type | Description |
|---|---|
WorkspaceClient
|
The Databricks client instance. |
config: DatabricksStepOperatorConfig
property
Returns the step operator config.
Returns:
| Type | Description |
|---|---|
DatabricksStepOperatorConfig
|
The configuration. |
entrypoint_config_class: Type[DatabricksStepOperatorEntrypointConfiguration]
property
Returns the entrypoint configuration class for Databricks steps.
Returns:
| Type | Description |
|---|---|
Type[DatabricksStepOperatorEntrypointConfiguration]
|
The Databricks step operator entrypoint configuration class. |
settings_class: Optional[Type[BaseSettings]]
property
Settings class for the Databricks step operator.
Returns:
| Type | Description |
|---|---|
Optional[Type[BaseSettings]]
|
The settings class. |
validator: Optional[StackValidator]
property
Validates the stack for Databricks step operator execution.
Returns:
| Type | Description |
|---|---|
Optional[StackValidator]
|
A validator that checks for a remote artifact store. |
cancel(step_run: StepRunResponse) -> None
Cancel a Databricks step run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run
|
StepRunResponse
|
The step run to cancel. |
required |
Source code in src/zenml/integrations/databricks/step_operators/databricks_step_operator.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | |
get_status(step_run: StepRunResponse) -> ExecutionStatus
Get the status of a Databricks step run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run
|
StepRunResponse
|
The step run to get the status of. |
required |
Returns:
| Type | Description |
|---|---|
ExecutionStatus
|
The ZenML step execution status. |
Source code in src/zenml/integrations/databricks/step_operators/databricks_step_operator.py
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 | |
submit(info: StepRunInfo, entrypoint_command: List[str], environment: Dict[str, str]) -> None
Submit a step run to Databricks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
info
|
StepRunInfo
|
Information about the step run. |
required |
entrypoint_command
|
List[str]
|
Command that executes the step. |
required |
environment
|
Dict[str, str]
|
Environment variables to set in the step operator environment. |
required |
Raises:
| Type | Description |
|---|---|
Exception
|
If wheel upload or Databricks run submission fails after cleanup. |
RuntimeError
|
If the stack or Databricks run ID is missing. |
Source code in src/zenml/integrations/databricks/step_operators/databricks_step_operator.py
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 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 | |
Modules
databricks_step_operator
Databricks step operator implementation.
DatabricksStepOperator(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, environment: Optional[Dict[str, str]] = None, secrets: Optional[List[UUID]] = None, 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: BaseStepOperator
Step operator to run individual steps on Databricks.
Source code in src/zenml/stack/stack_component.py
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 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
client: DatabricksClient
property
Get or create the Databricks client.
Returns:
| Type | Description |
|---|---|
WorkspaceClient
|
The Databricks client instance. |
config: DatabricksStepOperatorConfig
property
Returns the step operator config.
Returns:
| Type | Description |
|---|---|
DatabricksStepOperatorConfig
|
The configuration. |
entrypoint_config_class: Type[DatabricksStepOperatorEntrypointConfiguration]
property
Returns the entrypoint configuration class for Databricks steps.
Returns:
| Type | Description |
|---|---|
Type[DatabricksStepOperatorEntrypointConfiguration]
|
The Databricks step operator entrypoint configuration class. |
settings_class: Optional[Type[BaseSettings]]
property
Settings class for the Databricks step operator.
Returns:
| Type | Description |
|---|---|
Optional[Type[BaseSettings]]
|
The settings class. |
validator: Optional[StackValidator]
property
Validates the stack for Databricks step operator execution.
Returns:
| Type | Description |
|---|---|
Optional[StackValidator]
|
A validator that checks for a remote artifact store. |
cancel(step_run: StepRunResponse) -> None
Cancel a Databricks step run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run
|
StepRunResponse
|
The step run to cancel. |
required |
Source code in src/zenml/integrations/databricks/step_operators/databricks_step_operator.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | |
get_status(step_run: StepRunResponse) -> ExecutionStatus
Get the status of a Databricks step run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run
|
StepRunResponse
|
The step run to get the status of. |
required |
Returns:
| Type | Description |
|---|---|
ExecutionStatus
|
The ZenML step execution status. |
Source code in src/zenml/integrations/databricks/step_operators/databricks_step_operator.py
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 | |
submit(info: StepRunInfo, entrypoint_command: List[str], environment: Dict[str, str]) -> None
Submit a step run to Databricks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
info
|
StepRunInfo
|
Information about the step run. |
required |
entrypoint_command
|
List[str]
|
Command that executes the step. |
required |
environment
|
Dict[str, str]
|
Environment variables to set in the step operator environment. |
required |
Raises:
| Type | Description |
|---|---|
Exception
|
If wheel upload or Databricks run submission fails after cleanup. |
RuntimeError
|
If the stack or Databricks run ID is missing. |
Source code in src/zenml/integrations/databricks/step_operators/databricks_step_operator.py
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 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 | |
databricks_step_operator_entrypoint_config
Entrypoint configuration for Databricks step operator execution.
DatabricksStepOperatorEntrypointConfiguration(*args: Any, **kwargs: Any)
Bases: StepOperatorEntrypointConfiguration
Entrypoint configuration for Databricks step operator steps.
Source code in src/zenml/step_operators/step_operator_entrypoint_configuration.py
38 39 40 41 42 43 44 45 46 | |
get_entrypoint_arguments(**kwargs: Any) -> List[str]
classmethod
Gets the arguments for the Databricks step operator entrypoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Keyword arguments, must include the wheel package. |
{}
|
Returns:
| Type | Description |
|---|---|
List[str]
|
The entrypoint arguments. |
Source code in src/zenml/integrations/databricks/step_operators/databricks_step_operator_entrypoint_config.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
get_entrypoint_command() -> List[str]
classmethod
Returns the command used by Databricks Python wheel tasks.
Returns:
| Type | Description |
|---|---|
List[str]
|
Databricks wheel task entrypoint command. |
Source code in src/zenml/integrations/databricks/step_operators/databricks_step_operator_entrypoint_config.py
33 34 35 36 37 38 39 40 | |
get_entrypoint_options() -> Dict[str, bool]
classmethod
Gets all options required for running with this configuration.
Returns:
| Type | Description |
|---|---|
Dict[str, bool]
|
The superclass options plus the wheel package option. |
Source code in src/zenml/integrations/databricks/step_operators/databricks_step_operator_entrypoint_config.py
42 43 44 45 46 47 48 49 50 51 | |
run() -> None
Runs the Databricks step operator step.
Source code in src/zenml/integrations/databricks/step_operators/databricks_step_operator_entrypoint_config.py
76 77 78 79 80 81 | |
utils
Utilities for Databricks integration.
Modules
databricks_utils
Databricks utilities.
add_wheel_package_to_sys_path(wheel_package: str) -> str
Add the generated wheel package root to the Python path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wheel_package
|
str
|
The generated wheel package name. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Absolute path to the package root inside the installed wheel. |
Source code in src/zenml/integrations/databricks/utils/databricks_utils.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |
build_access_control_list(settings: DatabricksBaseSettings) -> Optional[List[iam.AccessControlRequest]]
Build access control entries for Databricks jobs and runs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
DatabricksBaseSettings
|
Databricks settings. |
required |
Returns:
| Type | Description |
|---|---|
Optional[List[AccessControlRequest]]
|
Access control list or None. |
Source code in src/zenml/integrations/databricks/utils/databricks_utils.py
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 | |
build_databricks_cluster_spec(databricks_client: DatabricksClient, settings: DatabricksBaseSettings, env_vars: Dict[str, str]) -> ClusterSpec
Build a Databricks cluster spec from shared settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
databricks_client
|
WorkspaceClient
|
Databricks client. |
required |
settings
|
DatabricksBaseSettings
|
Databricks settings. |
required |
env_vars
|
Dict[str, str]
|
Environment variables for the cluster. |
required |
Returns:
| Type | Description |
|---|---|
ClusterSpec
|
Cluster spec. |
Source code in src/zenml/integrations/databricks/utils/databricks_utils.py
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 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | |
collect_requirements(docker_settings: DockerSettings, stack: Stack) -> List[str]
Collect clean Python requirements for Databricks wheel execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
docker_settings
|
DockerSettings
|
Docker settings attached to the step or pipeline. |
required |
stack
|
Stack
|
The active stack. |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
A sorted list of clean requirements. |
Source code in src/zenml/integrations/databricks/utils/databricks_utils.py
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 | |
configure_databricks_wheel_environment(wheel_package: str) -> str
Configure runtime environment variables for a Databricks wheel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wheel_package
|
str
|
The generated wheel package name. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Absolute path to the package root inside the installed wheel. |
Source code in src/zenml/integrations/databricks/utils/databricks_utils.py
275 276 277 278 279 280 281 282 283 284 285 286 287 | |
convert_step_to_submit_task(task_name: str, command: str, arguments: List[str], new_cluster: ClusterSpec, libraries: Optional[List[str]] = None, zenml_project_wheel: Optional[str] = None, timeout_seconds: Optional[int] = None) -> SubmitTask
Convert a ZenML step to a Databricks submit task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_name
|
str
|
Name of the task. |
required |
command
|
str
|
Command to run. |
required |
arguments
|
List[str]
|
Arguments to pass to the command. |
required |
new_cluster
|
ClusterSpec
|
Cluster spec for the submit task. |
required |
libraries
|
Optional[List[str]]
|
List of libraries to install. |
None
|
zenml_project_wheel
|
Optional[str]
|
Path to the ZenML project wheel. |
None
|
timeout_seconds
|
Optional[int]
|
Timeout in seconds for the task. |
None
|
Returns:
| Type | Description |
|---|---|
SubmitTask
|
Databricks submit task. |
Source code in src/zenml/integrations/databricks/utils/databricks_utils.py
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 | |
convert_step_to_task(task_name: str, command: str, arguments: List[str], libraries: Optional[List[str]] = None, depends_on: Optional[List[str]] = None, zenml_project_wheel: Optional[str] = None, job_cluster_key: Optional[str] = None, timeout_seconds: Optional[int] = None, max_retries: Optional[int] = None, min_retry_interval_millis: Optional[int] = None, retry_on_timeout: Optional[bool] = None) -> DatabricksTask
Convert a ZenML step to a Databricks task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_name
|
str
|
Name of the task. |
required |
command
|
str
|
Command to run. |
required |
arguments
|
List[str]
|
Arguments to pass to the command. |
required |
libraries
|
Optional[List[str]]
|
List of libraries to install. |
None
|
depends_on
|
Optional[List[str]]
|
List of tasks to depend on. |
None
|
zenml_project_wheel
|
Optional[str]
|
Path to the ZenML project wheel. |
None
|
job_cluster_key
|
Optional[str]
|
ID of the Databricks job_cluster_key. |
None
|
timeout_seconds
|
Optional[int]
|
Timeout in seconds for the task. |
None
|
max_retries
|
Optional[int]
|
Maximum number of retries for a failed task. |
None
|
min_retry_interval_millis
|
Optional[int]
|
Minimum interval between retries in milliseconds. |
None
|
retry_on_timeout
|
Optional[bool]
|
Whether to retry on timeout. |
None
|
Returns:
| Type | Description |
|---|---|
Task
|
Databricks task. |
Source code in src/zenml/integrations/databricks/utils/databricks_utils.py
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 | |
delete_workspace_directory(databricks_client: DatabricksClient, databricks_directory: str, context: str) -> None
Delete a Databricks workspace directory best-effort.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
databricks_client
|
WorkspaceClient
|
Databricks client. |
required |
databricks_directory
|
str
|
Workspace directory to delete. |
required |
context
|
str
|
Context for warning logs if cleanup fails. |
required |
Source code in src/zenml/integrations/databricks/utils/databricks_utils.py
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 | |
get_databricks_wheel_source() -> Optional[tuple[str, str]]
Get the source root and package name of an installed Databricks wheel.
When code is already running from a Databricks wheel, building a new wheel from the active custom source root can point at the Databricks working directory instead of the packaged project source. In that case we rebuild from the installed wheel package contents instead.
Returns:
| Type | Description |
|---|---|
Optional[tuple[str, str]]
|
Tuple of (source_root, package_name) if running from a Databricks wheel, |
Optional[tuple[str, str]]
|
otherwise None. |
Source code in src/zenml/integrations/databricks/utils/databricks_utils.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
map_databricks_run_to_execution_status(run: Run) -> ExecutionStatus
Map a Databricks run state to a ZenML execution status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run
|
Run
|
Databricks run. |
required |
Returns:
| Type | Description |
|---|---|
ExecutionStatus
|
ZenML execution status. |
Source code in src/zenml/integrations/databricks/utils/databricks_utils.py
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 672 673 674 675 676 677 678 679 680 681 682 683 684 | |
sanitize_labels(labels: Dict[str, str]) -> None
Update the label values to be valid Databricks tag values.
Databricks tag values must contain only alphanumeric characters, underscores, hyphens, and periods, and must be at most 63 characters long with leading/trailing separators trimmed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
labels
|
Dict[str, str]
|
the labels to sanitize. |
required |
Source code in src/zenml/integrations/databricks/utils/databricks_utils.py
687 688 689 690 691 692 693 694 695 696 697 698 699 700 | |
upload_wheel_to_workspace(databricks_client: DatabricksClient, wheel_path: str, databricks_directory: str) -> str
Upload a wheel file to a Databricks workspace directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
databricks_client
|
WorkspaceClient
|
Databricks client. |
required |
wheel_path
|
str
|
Local wheel path. |
required |
databricks_directory
|
str
|
Remote Databricks directory path. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the wheel upload fails. |
Returns:
| Type | Description |
|---|---|
str
|
The Databricks workspace wheel path. |
Source code in src/zenml/integrations/databricks/utils/databricks_utils.py
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 205 206 | |