Ssh
zenml.integrations.ssh
SSH integration for remote pipeline and step execution.
Attributes
SSH = 'ssh'
module-attribute
SSH_ORCHESTRATOR_FLAVOR = 'ssh'
module-attribute
SSH_STEP_OPERATOR_FLAVOR = 'ssh'
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. |
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
Methods:
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 170 171 172 173 | |
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
223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
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
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 | |
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
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 | |
Integration
Base class for integration in ZenML.
Methods:
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 | |
SSHIntegration
Bases: Integration
Definition of SSH integration for ZenML.
Methods:
flavors() -> List[Type[Flavor]]
classmethod
Declare the stack component flavors for the SSH integration.
Returns:
| Type | Description |
|---|---|
List[Type[Flavor]]
|
List of new stack component flavors. |
Source code in src/zenml/integrations/ssh/__init__.py
32 33 34 35 36 37 38 39 40 41 42 43 44 | |
Modules
flavors
SSH integration flavors.
Classes
SSHOrchestratorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseOrchestratorConfig, BaseSSHComponentConfig, SSHOrchestratorSettings
Configuration for the SSH orchestrator.
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
Whether the orchestrator runs the pipeline locally.
Returns:
| Type | Description |
|---|---|
bool
|
False |
is_remote: bool
property
Whether the orchestrator runs the pipeline remotely.
Returns:
| Type | Description |
|---|---|
bool
|
True |
is_schedulable: bool
property
Whether the orchestrator supports scheduled pipeline runs.
Returns:
| Type | Description |
|---|---|
bool
|
False. |
SSHOrchestratorFlavor
Bases: BaseOrchestratorFlavor
SSH orchestrator flavor.
config_class: Type[SSHOrchestratorConfig]
property
Config class for the base orchestrator flavor.
Returns:
| Type | Description |
|---|---|
Type[SSHOrchestratorConfig]
|
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[SSHOrchestrator]
property
Implementation class for this flavor.
Returns:
| Type | Description |
|---|---|
Type[SSHOrchestrator]
|
Implementation class for this flavor. |
logo_url: str
property
A URL to represent the flavor in the dashboard.
Returns:
| Type | Description |
|---|---|
str
|
The flavor logo. |
name: str
property
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. |
SSHOrchestratorSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseSSHComponentSettings
Settings for the SSH orchestrator.
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 | |
SSHStepOperatorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseStepOperatorConfig, BaseSSHComponentConfig, SSHStepOperatorSettings
Configuration for the SSH step operator.
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 |
is_remote: bool
property
Checks if this stack component is running remotely.
Returns:
| Type | Description |
|---|---|
bool
|
True |
SSHStepOperatorFlavor
Bases: BaseStepOperatorFlavor
SSH step operator flavor.
config_class: Type[SSHStepOperatorConfig]
property
Returns SSHStepOperatorConfig config class.
Returns:
| Type | Description |
|---|---|
Type[SSHStepOperatorConfig]
|
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[SSHStepOperator]
property
Implementation class for this flavor.
Returns:
| Type | Description |
|---|---|
Type[SSHStepOperator]
|
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. |
SSHStepOperatorSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseSSHComponentSettings
Settings for the SSH 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 | |
Modules
base
Shared SSH configuration.
BaseSSHComponentConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: SSHConnectionConfigMixin
Shared SSH component configuration.
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 | |
BaseSSHComponentSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseSettings
Shared SSH component 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 | |
SSHConnectionConfigMixin(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseSettings
Shared SSH connection configuration.
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 | |
ssh_orchestrator_flavor
SSH orchestrator flavor.
SSHOrchestratorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseOrchestratorConfig, BaseSSHComponentConfig, SSHOrchestratorSettings
Configuration for the SSH orchestrator.
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
Whether the orchestrator runs the pipeline locally.
Returns:
| Type | Description |
|---|---|
bool
|
False |
is_remote: bool
property
Whether the orchestrator runs the pipeline remotely.
Returns:
| Type | Description |
|---|---|
bool
|
True |
is_schedulable: bool
property
Whether the orchestrator supports scheduled pipeline runs.
Returns:
| Type | Description |
|---|---|
bool
|
False. |
SSHOrchestratorFlavor
Bases: BaseOrchestratorFlavor
SSH orchestrator flavor.
config_class: Type[SSHOrchestratorConfig]
property
Config class for the base orchestrator flavor.
Returns:
| Type | Description |
|---|---|
Type[SSHOrchestratorConfig]
|
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[SSHOrchestrator]
property
Implementation class for this flavor.
Returns:
| Type | Description |
|---|---|
Type[SSHOrchestrator]
|
Implementation class for this flavor. |
logo_url: str
property
A URL to represent the flavor in the dashboard.
Returns:
| Type | Description |
|---|---|
str
|
The flavor logo. |
name: str
property
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. |
SSHOrchestratorSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseSSHComponentSettings
Settings for the SSH orchestrator.
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 | |
ssh_step_operator_flavor
SSH step operator flavor.
SSHStepOperatorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseStepOperatorConfig, BaseSSHComponentConfig, SSHStepOperatorSettings
Configuration for the SSH step operator.
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 |
is_remote: bool
property
Checks if this stack component is running remotely.
Returns:
| Type | Description |
|---|---|
bool
|
True |
SSHStepOperatorFlavor
Bases: BaseStepOperatorFlavor
SSH step operator flavor.
config_class: Type[SSHStepOperatorConfig]
property
Returns SSHStepOperatorConfig config class.
Returns:
| Type | Description |
|---|---|
Type[SSHStepOperatorConfig]
|
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[SSHStepOperator]
property
Implementation class for this flavor.
Returns:
| Type | Description |
|---|---|
Type[SSHStepOperator]
|
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. |
SSHStepOperatorSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseSSHComponentSettings
Settings for the SSH 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 | |
orchestrators
SSH orchestrator.
Classes
SSHOrchestrator(*args: Any, **kwargs: Any)
Bases: ContainerizedOrchestrator
Orchestrator that runs pipelines on a remote host via SSH + Docker.
Initialize the SSH orchestrator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args
|
Any
|
Forwarded to the base orchestrator. |
()
|
**kwargs
|
Any
|
Forwarded to the base orchestrator. |
{}
|
Source code in src/zenml/integrations/ssh/orchestrators/ssh_orchestrator.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
config: SSHOrchestratorConfig
property
settings_class: Optional[Type[BaseSettings]]
property
Settings class for the SSH orchestrator.
Returns:
| Type | Description |
|---|---|
Optional[Type[BaseSettings]]
|
The settings class. |
supported_execution_modes: List[ExecutionMode]
property
Execution modes supported by this orchestrator.
Returns:
| Type | Description |
|---|---|
List[ExecutionMode]
|
The supported execution modes. |
validator: Optional[StackValidator]
property
Validates that the stack can run containerized pipelines.
Returns:
| Type | Description |
|---|---|
Optional[StackValidator]
|
A stack validator requiring a container registry and image |
Optional[StackValidator]
|
builder. |
get_isolated_step_status(step_run: StepRunResponse) -> ExecutionStatus
Report the status of an isolated step subprocess.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run
|
StepRunResponse
|
The step run to check. |
required |
Returns:
| Type | Description |
|---|---|
ExecutionStatus
|
The execution status. |
Source code in src/zenml/integrations/ssh/orchestrators/ssh_orchestrator.py
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | |
get_orchestrator_run_id() -> str
The run id, read from the execution environment.
Returns:
| Type | Description |
|---|---|
str
|
The orchestrator run id. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If called outside the remote execution environment (the env var is only set inside the launched containers). |
Source code in src/zenml/integrations/ssh/orchestrators/ssh_orchestrator.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
stop_isolated_step(step_run: StepRunResponse) -> None
Terminate an isolated step subprocess (preemption / fail-fast).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run
|
StepRunResponse
|
The step run to stop. |
required |
Source code in src/zenml/integrations/ssh/orchestrators/ssh_orchestrator.py
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 | |
submit_dynamic_pipeline(snapshot: PipelineSnapshotResponse, stack: Stack, environment: Dict[str, str], placeholder_run: Optional[PipelineRunResponse] = None) -> Optional[SubmissionResult]
Submit a dynamic pipeline by launching the orchestrator image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
PipelineSnapshotResponse
|
The pipeline snapshot. |
required |
stack
|
Stack
|
The active stack. |
required |
environment
|
Dict[str, str]
|
Environment variables for the orchestrator container. |
required |
placeholder_run
|
Optional[PipelineRunResponse]
|
The placeholder run for the pipeline. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[SubmissionResult]
|
None |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the dynamic pipeline has a schedule, which is not supported. |
Source code in src/zenml/integrations/ssh/orchestrators/ssh_orchestrator.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 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
submit_isolated_step(step_run_info: StepRunInfo, environment: Dict[str, str]) -> None
Launch one isolated step as a subprocess.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run_info
|
StepRunInfo
|
The step run information. |
required |
environment
|
Dict[str, str]
|
Environment variables for the step process. |
required |
Source code in src/zenml/integrations/ssh/orchestrators/ssh_orchestrator.py
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | |
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]
Submit a static pipeline as a remote Docker Compose DAG.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
PipelineSnapshotResponse
|
The pipeline snapshot. |
required |
stack
|
Stack
|
The active stack. |
required |
base_environment
|
Dict[str, str]
|
Environment shared by all steps (unused; the per-step environments already include it). |
required |
step_environments
|
Dict[str, Dict[str, str]]
|
Per-step environment variables. |
required |
placeholder_run
|
Optional[PipelineRunResponse]
|
The placeholder run for the pipeline. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[SubmissionResult]
|
None |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the pipeline has a schedule, which is not supported. |
Source code in src/zenml/integrations/ssh/orchestrators/ssh_orchestrator.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 400 401 402 403 404 405 406 | |
Modules
ssh_orchestrator
SSH orchestrator implementation.
SSHOrchestrator(*args: Any, **kwargs: Any)
Bases: ContainerizedOrchestrator
Orchestrator that runs pipelines on a remote host via SSH + Docker.
Initialize the SSH orchestrator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args
|
Any
|
Forwarded to the base orchestrator. |
()
|
**kwargs
|
Any
|
Forwarded to the base orchestrator. |
{}
|
Source code in src/zenml/integrations/ssh/orchestrators/ssh_orchestrator.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
config: SSHOrchestratorConfig
property
settings_class: Optional[Type[BaseSettings]]
property
Settings class for the SSH orchestrator.
Returns:
| Type | Description |
|---|---|
Optional[Type[BaseSettings]]
|
The settings class. |
supported_execution_modes: List[ExecutionMode]
property
Execution modes supported by this orchestrator.
Returns:
| Type | Description |
|---|---|
List[ExecutionMode]
|
The supported execution modes. |
validator: Optional[StackValidator]
property
Validates that the stack can run containerized pipelines.
Returns:
| Type | Description |
|---|---|
Optional[StackValidator]
|
A stack validator requiring a container registry and image |
Optional[StackValidator]
|
builder. |
get_isolated_step_status(step_run: StepRunResponse) -> ExecutionStatus
Report the status of an isolated step subprocess.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run
|
StepRunResponse
|
The step run to check. |
required |
Returns:
| Type | Description |
|---|---|
ExecutionStatus
|
The execution status. |
Source code in src/zenml/integrations/ssh/orchestrators/ssh_orchestrator.py
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | |
get_orchestrator_run_id() -> str
The run id, read from the execution environment.
Returns:
| Type | Description |
|---|---|
str
|
The orchestrator run id. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If called outside the remote execution environment (the env var is only set inside the launched containers). |
Source code in src/zenml/integrations/ssh/orchestrators/ssh_orchestrator.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
stop_isolated_step(step_run: StepRunResponse) -> None
Terminate an isolated step subprocess (preemption / fail-fast).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run
|
StepRunResponse
|
The step run to stop. |
required |
Source code in src/zenml/integrations/ssh/orchestrators/ssh_orchestrator.py
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 | |
submit_dynamic_pipeline(snapshot: PipelineSnapshotResponse, stack: Stack, environment: Dict[str, str], placeholder_run: Optional[PipelineRunResponse] = None) -> Optional[SubmissionResult]
Submit a dynamic pipeline by launching the orchestrator image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
PipelineSnapshotResponse
|
The pipeline snapshot. |
required |
stack
|
Stack
|
The active stack. |
required |
environment
|
Dict[str, str]
|
Environment variables for the orchestrator container. |
required |
placeholder_run
|
Optional[PipelineRunResponse]
|
The placeholder run for the pipeline. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[SubmissionResult]
|
None |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the dynamic pipeline has a schedule, which is not supported. |
Source code in src/zenml/integrations/ssh/orchestrators/ssh_orchestrator.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 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
submit_isolated_step(step_run_info: StepRunInfo, environment: Dict[str, str]) -> None
Launch one isolated step as a subprocess.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run_info
|
StepRunInfo
|
The step run information. |
required |
environment
|
Dict[str, str]
|
Environment variables for the step process. |
required |
Source code in src/zenml/integrations/ssh/orchestrators/ssh_orchestrator.py
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | |
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]
Submit a static pipeline as a remote Docker Compose DAG.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
PipelineSnapshotResponse
|
The pipeline snapshot. |
required |
stack
|
Stack
|
The active stack. |
required |
base_environment
|
Dict[str, str]
|
Environment shared by all steps (unused; the per-step environments already include it). |
required |
step_environments
|
Dict[str, Dict[str, str]]
|
Per-step environment variables. |
required |
placeholder_run
|
Optional[PipelineRunResponse]
|
The placeholder run for the pipeline. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[SubmissionResult]
|
None |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the pipeline has a schedule, which is not supported. |
Source code in src/zenml/integrations/ssh/orchestrators/ssh_orchestrator.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 400 401 402 403 404 405 406 | |
ssh_client
SSH client wrapper around paramiko.
Classes
RemoteCommandResult(exit_code: int, stdout: str = '', stderr: str = '')
dataclass
Result of a remote command execution.
Attributes:
| Name | Type | Description |
|---|---|---|
exit_code |
int
|
Process exit code (0 = success). |
stdout |
str
|
Captured standard output. |
stderr |
str
|
Captured standard error (empty when combined with stdout). |
SSHClient(config: SSHConnectionConfigMixin)
dataclass
Context-managed SSH client that wraps paramiko.
Attributes:
| Name | Type | Description |
|---|---|---|
config |
SSHConnectionConfigMixin
|
Connection configuration. |
exec(command: str, *, stream: bool = False, get_pty: bool = False, combine_stderr: bool = False) -> RemoteCommandResult
Execute a command on the remote host.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
Shell command to execute. |
required |
stream
|
bool
|
If True, stream stdout to the local logger in real time. |
False
|
get_pty
|
bool
|
Request a pseudo-terminal (improves log buffering for long-running commands). |
False
|
combine_stderr
|
bool
|
If True, merge stderr into stdout on the channel to avoid buffer deadlocks on long output. |
False
|
Returns:
| Type | Description |
|---|---|
RemoteCommandResult
|
RemoteCommandResult with exit code and captured output. |
Source code in src/zenml/integrations/ssh/ssh_client.py
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 | |
put_text(remote_path: str, content: str, *, mode: int = 384) -> None
Upload text content to a file on the remote host via SFTP.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
remote_path
|
str
|
Absolute path on the remote host. |
required |
content
|
str
|
Text content to write. |
required |
mode
|
int
|
File permissions (default: owner read/write only). |
384
|
Source code in src/zenml/integrations/ssh/ssh_client.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 | |
read_text(remote_path: str) -> str
Read a remote file's text contents via SFTP.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
remote_path
|
str
|
Absolute path on the remote host. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The file contents as a string. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the file does not exist. |
Source code in src/zenml/integrations/ssh/ssh_client.py
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | |
sftp() -> Iterator[paramiko.SFTPClient]
Open an SFTP session over the active connection.
Yields:
| Type | Description |
|---|---|
SFTPClient
|
An open paramiko SFTP client. |
Source code in src/zenml/integrations/ssh/ssh_client.py
359 360 361 362 363 364 365 366 367 368 369 370 371 | |
Functions:
step_operators
SSH step operator.
Classes
SSHStepOperator(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 that executes steps on a remote host via SSH + Docker.
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: SSHStepOperatorConfig
property
Get the SSH step operator configuration.
Returns:
| Type | Description |
|---|---|
SSHStepOperatorConfig
|
The SSH step operator configuration. |
settings_class: Optional[Type[BaseSettings]]
property
Get the settings class for the SSH step operator.
Returns:
| Type | Description |
|---|---|
Optional[Type[BaseSettings]]
|
The SSH step operator settings class. |
validator: Optional[StackValidator]
property
Validate that the stack meets remote execution requirements.
Returns:
| Type | Description |
|---|---|
Optional[StackValidator]
|
A stack validator. |
cancel(step_run: StepRunResponse) -> None
Cancel a submitted step by stopping its Docker container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run
|
StepRunResponse
|
The step run to cancel. |
required |
Source code in src/zenml/integrations/ssh/step_operators/ssh_step_operator.py
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 | |
get_docker_builds(snapshot: PipelineSnapshotBase) -> List[BuildConfiguration]
Declare Docker builds needed for steps using this operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
PipelineSnapshotBase
|
The pipeline snapshot. |
required |
Returns:
| Type | Description |
|---|---|
List[BuildConfiguration]
|
A list of Docker build configurations, one per step that uses |
List[BuildConfiguration]
|
this step operator. |
Source code in src/zenml/integrations/ssh/step_operators/ssh_step_operator.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
get_status(step_run: StepRunResponse) -> ExecutionStatus
Get the execution status of a submitted step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run
|
StepRunResponse
|
The step run to check. |
required |
Returns:
| Type | Description |
|---|---|
ExecutionStatus
|
The current execution status. |
Source code in src/zenml/integrations/ssh/step_operators/ssh_step_operator.py
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 | |
submit(info: StepRunInfo, entrypoint_command: List[str], environment: Dict[str, str]) -> None
Submit a step for asynchronous execution on the remote host.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
info
|
StepRunInfo
|
The step run information. |
required |
entrypoint_command
|
List[str]
|
The entrypoint command for the step. |
required |
environment
|
Dict[str, str]
|
Environment variables for the step container. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the image pull or container start fails. |
Source code in src/zenml/integrations/ssh/step_operators/ssh_step_operator.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 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 | |
Modules
ssh_step_operator
SSH step operator implementation.
SSHStepOperator(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 that executes steps on a remote host via SSH + Docker.
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: SSHStepOperatorConfig
property
Get the SSH step operator configuration.
Returns:
| Type | Description |
|---|---|
SSHStepOperatorConfig
|
The SSH step operator configuration. |
settings_class: Optional[Type[BaseSettings]]
property
Get the settings class for the SSH step operator.
Returns:
| Type | Description |
|---|---|
Optional[Type[BaseSettings]]
|
The SSH step operator settings class. |
validator: Optional[StackValidator]
property
Validate that the stack meets remote execution requirements.
Returns:
| Type | Description |
|---|---|
Optional[StackValidator]
|
A stack validator. |
cancel(step_run: StepRunResponse) -> None
Cancel a submitted step by stopping its Docker container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run
|
StepRunResponse
|
The step run to cancel. |
required |
Source code in src/zenml/integrations/ssh/step_operators/ssh_step_operator.py
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 | |
get_docker_builds(snapshot: PipelineSnapshotBase) -> List[BuildConfiguration]
Declare Docker builds needed for steps using this operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
PipelineSnapshotBase
|
The pipeline snapshot. |
required |
Returns:
| Type | Description |
|---|---|
List[BuildConfiguration]
|
A list of Docker build configurations, one per step that uses |
List[BuildConfiguration]
|
this step operator. |
Source code in src/zenml/integrations/ssh/step_operators/ssh_step_operator.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
get_status(step_run: StepRunResponse) -> ExecutionStatus
Get the execution status of a submitted step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run
|
StepRunResponse
|
The step run to check. |
required |
Returns:
| Type | Description |
|---|---|
ExecutionStatus
|
The current execution status. |
Source code in src/zenml/integrations/ssh/step_operators/ssh_step_operator.py
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 | |
submit(info: StepRunInfo, entrypoint_command: List[str], environment: Dict[str, str]) -> None
Submit a step for asynchronous execution on the remote host.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
info
|
StepRunInfo
|
The step run information. |
required |
entrypoint_command
|
List[str]
|
The entrypoint command for the step. |
required |
environment
|
Dict[str, str]
|
Environment variables for the step container. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the image pull or container start fails. |
Source code in src/zenml/integrations/ssh/step_operators/ssh_step_operator.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 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 | |
utils
SSH integration utilities.
Classes
Functions:
build_compose_gpu_deploy(gpu_indices: Sequence[int]) -> Dict[str, Any]
Build the Compose deploy section reserving the given GPUs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gpu_indices
|
Sequence[int]
|
GPU device indices to reserve. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
A Compose service deploy section. |
Source code in src/zenml/integrations/ssh/utils.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
build_docker_gpus_flag(gpu_indices: Sequence[int]) -> str
Build the value for the Docker --gpus flag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gpu_indices
|
Sequence[int]
|
Normalized (sorted, unique) GPU device indices. |
required |
Returns:
| Type | Description |
|---|---|
str
|
String suitable for |
str
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If no GPU indices are provided. |
Source code in src/zenml/integrations/ssh/utils.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
build_docker_run_command(*, docker_binary: str, image: str, args: Sequence[str], container_name: str, env_file: Optional[str] = None, network: Optional[str] = None, entrypoint: Optional[str] = None, gpu_indices: Optional[Sequence[int]] = None, mounts: Optional[Mapping[str, str]] = None, extra_args: Optional[Sequence[str]] = None) -> str
Build a detached docker run command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
docker_binary
|
str
|
Path to the Docker binary on the remote host. |
required |
image
|
str
|
Fully-qualified image to run. |
required |
args
|
Sequence[str]
|
Arguments passed after the image. |
required |
container_name
|
str
|
Container name. |
required |
env_file
|
Optional[str]
|
Path to a Docker env-file. |
None
|
network
|
Optional[str]
|
Docker network mode. |
None
|
entrypoint
|
Optional[str]
|
Entrypoint override. |
None
|
gpu_indices
|
Optional[Sequence[int]]
|
GPU device indices to attach, or None for CPU. |
None
|
mounts
|
Optional[Mapping[str, str]]
|
Host-path to container-path bind mounts. |
None
|
extra_args
|
Optional[Sequence[str]]
|
Additional |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The full |
Source code in src/zenml/integrations/ssh/utils.py
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 190 191 192 193 | |
build_mount_mappings(mounts: Mapping[str, str]) -> List[str]
Build validated host:container bind-mount mappings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mounts
|
Mapping[str, str]
|
Mapping of host paths to container paths. |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
List of validated "host:container" mapping strings. |
Source code in src/zenml/integrations/ssh/utils.py
96 97 98 99 100 101 102 103 104 105 106 107 108 | |
check_remote_disk(ssh: SSHClient, remote_path: str, minimum_free_disk_gb: float) -> None
Fail fast if the remote host is low on disk for the given path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ssh
|
SSHClient
|
The open SSH connection. |
required |
remote_path
|
str
|
An existing remote path on the filesystem to check. |
required |
minimum_free_disk_gb
|
float
|
Minimum free space required, in GB. Values of 0 or below disable the check. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If free disk is below minimum_free_disk_gb. |
Source code in src/zenml/integrations/ssh/utils.py
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 | |
docker_login(ssh: SSHClient, container_registry: BaseContainerRegistry, docker_binary: str) -> None
Log the remote Docker into the container registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ssh
|
SSHClient
|
The open SSH connection. |
required |
container_registry
|
BaseContainerRegistry
|
The container registry to authenticate against. |
required |
docker_binary
|
str
|
Path to the Docker binary on the remote host. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If registry credentials are missing or the remote
|
Source code in src/zenml/integrations/ssh/utils.py
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 | |
get_free_disk_bytes(ssh: SSHClient, remote_path: str) -> Optional[int]
Get free disk space on the filesystem holding a remote path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ssh
|
SSHClient
|
An open SSH connection. |
required |
remote_path
|
str
|
An existing path on the remote host. |
required |
Returns:
| Type | Description |
|---|---|
Optional[int]
|
Free bytes available to a non-root user, or None if the SFTP server |
Optional[int]
|
does not support statvfs. |
Source code in src/zenml/integrations/ssh/utils.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
normalize_gpu_indices(indices: Sequence[int]) -> List[int]
Normalize GPU indices into a sorted, unique, validated list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
indices
|
Sequence[int]
|
GPU device indices (may be unsorted or contain duplicates). |
required |
Returns:
| Type | Description |
|---|---|
List[int]
|
Sorted unique list of non-negative GPU indices. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any index is negative. |
Source code in src/zenml/integrations/ssh/utils.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
prepare_remote_workdir(ssh: SSHClient, *, docker_binary: str, workdir: str, minimum_free_disk_gb: float, cleanup_command: Optional[str] = None, container_registry: Optional[BaseContainerRegistry] = None) -> None
Run preflight checks and prepare a remote working directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ssh
|
SSHClient
|
The open SSH connection. |
required |
docker_binary
|
str
|
Path to the Docker binary on the remote host. |
required |
workdir
|
str
|
Remote directory to create and disk-check. |
required |
minimum_free_disk_gb
|
float
|
Minimum free space required, in GB. |
required |
cleanup_command
|
Optional[str]
|
Command removing stale files, or None to skip. |
None
|
container_registry
|
Optional[BaseContainerRegistry]
|
Container registry to authenticate Docker against, or None to skip. |
None
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If a required tool is missing or a remote command fails. |
Source code in src/zenml/integrations/ssh/utils.py
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 | |
run_preflight_checks(ssh: SSHClient, docker_binary: str) -> None
Verify the remote host has the required tools installed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ssh
|
SSHClient
|
The open SSH connection. |
required |
docker_binary
|
str
|
Path to the Docker binary on the remote host. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If a required tool is missing. |
Source code in src/zenml/integrations/ssh/utils.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
serialize_env_for_docker_env_file(env: Mapping[str, str]) -> str
Serialize environment variables into Docker --env-file format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env
|
Mapping[str, str]
|
Mapping of environment variable names to values. |
required |
Returns:
| Type | Description |
|---|---|
str
|
String content suitable for writing to a Docker env-file. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any key or value contains forbidden characters. |
Source code in src/zenml/integrations/ssh/utils.py
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 | |
validate_mount_path(path: str) -> str
Validate a bind-mount path against injection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The host or container path. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The validated path. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the path is not a plain absolute path. |
Source code in src/zenml/integrations/ssh/utils.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |