Aws
zenml.integrations.aws
Integrates multiple AWS Tools as Stack Components.
The AWS integration provides a way for our users to manage their secrets through AWS, a way to use the aws container registry. Additionally, the Sagemaker integration submodule provides a way to run ZenML steps in Sagemaker.
Attributes
AWS = 'aws'
module-attribute
AWS_CONNECTOR_TYPE = 'aws'
module-attribute
AWS_CONTAINER_REGISTRY_FLAVOR = 'aws'
module-attribute
AWS_IMAGE_BUILDER_FLAVOR = 'aws'
module-attribute
AWS_RESOURCE_TYPE = 'aws-generic'
module-attribute
AWS_SAGEMAKER_ORCHESTRATOR_FLAVOR = 'sagemaker'
module-attribute
AWS_SAGEMAKER_STEP_OPERATOR_FLAVOR = 'sagemaker'
module-attribute
AWS_SECRET_MANAGER_FLAVOR = 'aws'
module-attribute
S3_RESOURCE_TYPE = 's3-bucket'
module-attribute
Classes
AWSIntegration
Bases: Integration
Definition of AWS integration for ZenML.
Functions
activate() -> None
classmethod
Activate the AWS integration.
Source code in src/zenml/integrations/aws/__init__.py
50 51 52 53 |
|
flavors() -> List[Type[Flavor]]
classmethod
Declare the stack component flavors for the AWS integration.
Returns:
Type | Description |
---|---|
List[Type[Flavor]]
|
List of stack component flavors for this integration. |
Source code in src/zenml/integrations/aws/__init__.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
Flavor
Class for ZenML Flavors.
Attributes
config_class: Type[StackComponentConfig]
abstractmethod
property
Returns StackComponentConfig
config class.
Returns:
Type | Description |
---|---|
Type[StackComponentConfig]
|
The config class. |
config_schema: Dict[str, Any]
property
The config schema for a flavor.
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The config schema. |
docs_url: Optional[str]
property
A url to point at docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor docs url. |
implementation_class: Type[StackComponent]
abstractmethod
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[StackComponent]
|
The implementation class for this flavor. |
logo_url: Optional[str]
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
Optional[str]
|
The flavor logo. |
name: str
abstractmethod
property
The flavor name.
Returns:
Type | Description |
---|---|
str
|
The flavor name. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
type: StackComponentType
abstractmethod
property
Functions
from_model(flavor_model: FlavorResponse) -> Flavor
classmethod
Loads a flavor from a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flavor_model
|
FlavorResponse
|
The model to load from. |
required |
Raises:
Type | Description |
---|---|
CustomFlavorImportError
|
If the custom flavor can't be imported. |
ImportError
|
If the flavor can't be imported. |
Returns:
Type | Description |
---|---|
Flavor
|
The loaded flavor. |
Source code in src/zenml/stack/flavor.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
generate_default_docs_url() -> str
Generate the doc urls for all inbuilt and integration flavors.
Note that this method is not going to be useful for custom flavors, which do not have any docs in the main zenml docs.
Returns:
Type | Description |
---|---|
str
|
The complete url to the zenml documentation |
Source code in src/zenml/stack/flavor.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
|
generate_default_sdk_docs_url() -> str
Generate SDK docs url for a flavor.
Returns:
Type | Description |
---|---|
str
|
The complete url to the zenml SDK docs |
Source code in src/zenml/stack/flavor.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
|
to_model(integration: Optional[str] = None, is_custom: bool = True) -> FlavorRequest
Converts a flavor to a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
integration
|
Optional[str]
|
The integration to use for the model. |
None
|
is_custom
|
bool
|
Whether the flavor is a custom flavor. |
True
|
Returns:
Type | Description |
---|---|
FlavorRequest
|
The model. |
Source code in src/zenml/stack/flavor.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
Integration
Base class for integration in ZenML.
Functions
activate() -> None
classmethod
Abstract method to activate the integration.
Source code in src/zenml/integrations/integration.py
175 176 177 |
|
check_installation() -> bool
classmethod
Method to check whether the required packages are installed.
Returns:
Type | Description |
---|---|
bool
|
True if all required packages are installed, False otherwise. |
Source code in src/zenml/integrations/integration.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
flavors() -> List[Type[Flavor]]
classmethod
Abstract method to declare new stack component flavors.
Returns:
Type | Description |
---|---|
List[Type[Flavor]]
|
A list of new stack component flavors. |
Source code in src/zenml/integrations/integration.py
179 180 181 182 183 184 185 186 |
|
get_requirements(target_os: Optional[str] = None, python_version: Optional[str] = None) -> List[str]
classmethod
Method to get the requirements for the integration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_os
|
Optional[str]
|
The target operating system to get the requirements for. |
None
|
python_version
|
Optional[str]
|
The Python version to use for the requirements. |
None
|
Returns:
Type | Description |
---|---|
List[str]
|
A list of requirements. |
Source code in src/zenml/integrations/integration.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|
get_uninstall_requirements(target_os: Optional[str] = None) -> List[str]
classmethod
Method to get the uninstall requirements for the integration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_os
|
Optional[str]
|
The target operating system to get the requirements for. |
None
|
Returns:
Type | Description |
---|---|
List[str]
|
A list of requirements. |
Source code in src/zenml/integrations/integration.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
plugin_flavors() -> List[Type[BasePluginFlavor]]
classmethod
Abstract method to declare new plugin flavors.
Returns:
Type | Description |
---|---|
List[Type[BasePluginFlavor]]
|
A list of new plugin flavors. |
Source code in src/zenml/integrations/integration.py
188 189 190 191 192 193 194 195 |
|
Modules
container_registries
Initialization of AWS Container Registry integration.
Classes
AWSContainerRegistry(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, labels: Optional[Dict[str, Any]] = None, connector_requirements: Optional[ServiceConnectorRequirements] = None, connector: Optional[UUID] = None, connector_resource_id: Optional[str] = None, *args: Any, **kwargs: Any)
Bases: BaseContainerRegistry
Class for AWS Container Registry.
Source code in src/zenml/stack/stack_component.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
config: AWSContainerRegistryConfig
property
Returns the AWSContainerRegistryConfig
config.
Returns:
Type | Description |
---|---|
AWSContainerRegistryConfig
|
The configuration. |
post_registration_message: Optional[str]
property
Optional message printed after the stack component is registered.
Returns:
Type | Description |
---|---|
Optional[str]
|
Info message regarding docker repositories in AWS. |
prepare_image_push(image_name: str) -> None
Logs warning message if trying to push an image for which no repository exists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_name
|
str
|
Name of the docker image that will be pushed. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the docker image name is invalid. |
Source code in src/zenml/integrations/aws/container_registries/aws_container_registry.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
Modules
aws_container_registry
Implementation of the AWS container registry integration.
AWSContainerRegistry(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, labels: Optional[Dict[str, Any]] = None, connector_requirements: Optional[ServiceConnectorRequirements] = None, connector: Optional[UUID] = None, connector_resource_id: Optional[str] = None, *args: Any, **kwargs: Any)
Bases: BaseContainerRegistry
Class for AWS Container Registry.
Source code in src/zenml/stack/stack_component.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
config: AWSContainerRegistryConfig
property
Returns the AWSContainerRegistryConfig
config.
Returns:
Type | Description |
---|---|
AWSContainerRegistryConfig
|
The configuration. |
post_registration_message: Optional[str]
property
Optional message printed after the stack component is registered.
Returns:
Type | Description |
---|---|
Optional[str]
|
Info message regarding docker repositories in AWS. |
prepare_image_push(image_name: str) -> None
Logs warning message if trying to push an image for which no repository exists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_name
|
str
|
Name of the docker image that will be pushed. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the docker image name is invalid. |
Source code in src/zenml/integrations/aws/container_registries/aws_container_registry.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
flavors
AWS integration flavors.
Classes
AWSContainerRegistryConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseContainerRegistryConfig
Configuration for AWS Container Registry.
Source code in src/zenml/stack/stack_component.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
validate_aws_uri(uri: str) -> str
classmethod
Validates that the URI is in the correct format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uri
|
str
|
URI to validate. |
required |
Returns:
Type | Description |
---|---|
str
|
URI in the correct format. |
Raises:
Type | Description |
---|---|
ValueError
|
If the URI contains a slash character. |
Source code in src/zenml/integrations/aws/flavors/aws_container_registry_flavor.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
AWSContainerRegistryFlavor
Bases: BaseContainerRegistryFlavor
AWS Container Registry flavor.
config_class: Type[AWSContainerRegistryConfig]
property
Config class for this flavor.
Returns:
Type | Description |
---|---|
Type[AWSContainerRegistryConfig]
|
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[AWSContainerRegistry]
property
Implementation class.
Returns:
Type | Description |
---|---|
Type[AWSContainerRegistry]
|
The implementation class. |
logo_url: str
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
str
|
The flavor logo. |
name: str
property
Name of the flavor.
Returns:
Type | Description |
---|---|
str
|
The name of the flavor. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
AWSImageBuilderConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseImageBuilderConfig
AWS Code Build image builder configuration.
Attributes:
Name | Type | Description |
---|---|---|
code_build_project |
str
|
The name of an existing AWS CodeBuild project to use to build the image. The CodeBuild project must exist in the AWS account and region inferred from the AWS service connector credentials or implicitly from the local AWS config. |
build_image |
str
|
The Docker image to use for the AWS CodeBuild environment. The image must have Docker installed and be able to run Docker commands. The default image is bentolor/docker-dind-awscli. This can be customized to use a mirror, if needed, in case the Dockerhub image is not accessible or rate-limited. |
custom_env_vars |
Optional[Dict[str, str]]
|
Custom environment variables to pass to the AWS CodeBuild build. |
compute_type |
str
|
The compute type to use for the AWS CodeBuild build. The default is BUILD_GENERAL1_SMALL. |
implicit_container_registry_auth |
bool
|
Whether to use implicit authentication to authenticate the AWS Code Build build to the container registry when pushing container images. If set to False, the container registry credentials must be explicitly configured for the container registry stack component or the container registry stack component must be linked to a service connector. NOTE: When implicit_container_registry_auth is set to False, the container registry credentials will be passed to the AWS Code Build build as environment variables. This is not recommended for production use unless your service connector is configured to generate short-lived credentials. |
Source code in src/zenml/stack/stack_component.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
AWSImageBuilderFlavor
Bases: BaseImageBuilderFlavor
AWS Code Build image builder flavor.
config_class: Type[BaseImageBuilderConfig]
property
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[AWSImageBuilder]
property
logo_url: str
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
str
|
The flavor logo. |
name: str
property
The flavor name.
Returns:
Type | Description |
---|---|
str
|
The name of the flavor. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
SagemakerOrchestratorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseOrchestratorConfig
, SagemakerOrchestratorSettings
Config for the Sagemaker orchestrator.
There are three ways to authenticate to AWS:
- By connecting a ServiceConnector
to the orchestrator,
- By configuring explicit AWS credentials aws_access_key_id
,
aws_secret_access_key
, and optional aws_auth_role_arn
,
- If none of the above are provided, unspecified credentials will be
loaded from the default AWS config.
Attributes:
Name | Type | Description |
---|---|---|
execution_role |
str
|
The IAM role ARN to use for the pipeline. |
scheduler_role |
Optional[str]
|
The ARN of the IAM role that will be assumed by the EventBridge service to launch Sagemaker pipelines (For more details regarding the required permissions, please check: https://docs.zenml.io/stack-components/orchestrators/sagemaker#required-iam-permissions-for-schedules) |
aws_access_key_id |
Optional[str]
|
The AWS access key ID to use to authenticate to AWS. If not provided, the value from the default AWS config will be used. |
aws_secret_access_key |
Optional[str]
|
The AWS secret access key to use to authenticate to AWS. If not provided, the value from the default AWS config will be used. |
aws_profile |
Optional[str]
|
The AWS profile to use for authentication if not using service connectors or explicit credentials. If not provided, the default profile will be used. |
aws_auth_role_arn |
Optional[str]
|
The ARN of an intermediate IAM role to assume when authenticating to AWS. |
region |
Optional[str]
|
The AWS region where the processing job will be run. If not provided, the value from the default AWS config will be used. |
bucket |
Optional[str]
|
Name of the S3 bucket to use for storing artifacts from the job run. If not provided, a default bucket will be created based on the following format: "sagemaker-{region}-{aws-account-id}". |
Source code in src/zenml/stack/stack_component.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
is_remote: bool
property
Checks if this stack component is running remotely.
This designation is used to determine if the stack component can be used with a local ZenML database or if it requires a remote ZenML server.
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. |
is_synchronous: bool
property
Whether the orchestrator runs synchronous or not.
Returns:
Type | Description |
---|---|
bool
|
Whether the orchestrator runs synchronous or not. |
SagemakerOrchestratorFlavor
Bases: BaseOrchestratorFlavor
Flavor for the Sagemaker orchestrator.
config_class: Type[SagemakerOrchestratorConfig]
property
Returns SagemakerOrchestratorConfig config class.
Returns:
Type | Description |
---|---|
Type[SagemakerOrchestratorConfig]
|
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[SagemakerOrchestrator]
property
Implementation class.
Returns:
Type | Description |
---|---|
Type[SagemakerOrchestrator]
|
The implementation class. |
logo_url: str
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
str
|
The flavor logo. |
name: str
property
Name of the flavor.
Returns:
Type | Description |
---|---|
str
|
The name of the flavor. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
SagemakerStepOperatorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseStepOperatorConfig
, SagemakerStepOperatorSettings
Config for the Sagemaker step operator.
Attributes:
Name | Type | Description |
---|---|---|
role |
str
|
The role that has to be assigned to the jobs which are running in Sagemaker. |
bucket |
Optional[str]
|
Name of the S3 bucket to use for storing artifacts from the job run. If not provided, a default bucket will be created based on the following format: "sagemaker-{region}-{aws-account-id}". |
Source code in src/zenml/stack/stack_component.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
is_remote: bool
property
Checks if this stack component is running remotely.
This designation is used to determine if the stack component can be used with a local ZenML database or if it requires a remote ZenML server.
Returns:
Type | Description |
---|---|
bool
|
True if this config is for a remote component, False otherwise. |
SagemakerStepOperatorFlavor
Bases: BaseStepOperatorFlavor
Flavor for the Sagemaker step operator.
config_class: Type[SagemakerStepOperatorConfig]
property
Returns SagemakerStepOperatorConfig config class.
Returns:
Type | Description |
---|---|
Type[SagemakerStepOperatorConfig]
|
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[SagemakerStepOperator]
property
Implementation class.
Returns:
Type | Description |
---|---|
Type[SagemakerStepOperator]
|
The implementation class. |
logo_url: str
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
str
|
The flavor logo. |
name: str
property
Name of the flavor.
Returns:
Type | Description |
---|---|
str
|
The name of the flavor. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
Modules
aws_container_registry_flavor
AWS container registry flavor.
AWSContainerRegistryConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseContainerRegistryConfig
Configuration for AWS Container Registry.
Source code in src/zenml/stack/stack_component.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
validate_aws_uri(uri: str) -> str
classmethod
Validates that the URI is in the correct format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uri
|
str
|
URI to validate. |
required |
Returns:
Type | Description |
---|---|
str
|
URI in the correct format. |
Raises:
Type | Description |
---|---|
ValueError
|
If the URI contains a slash character. |
Source code in src/zenml/integrations/aws/flavors/aws_container_registry_flavor.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
AWSContainerRegistryFlavor
Bases: BaseContainerRegistryFlavor
AWS Container Registry flavor.
config_class: Type[AWSContainerRegistryConfig]
property
Config class for this flavor.
Returns:
Type | Description |
---|---|
Type[AWSContainerRegistryConfig]
|
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[AWSContainerRegistry]
property
Implementation class.
Returns:
Type | Description |
---|---|
Type[AWSContainerRegistry]
|
The implementation class. |
logo_url: str
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
str
|
The flavor logo. |
name: str
property
Name of the flavor.
Returns:
Type | Description |
---|---|
str
|
The name of the flavor. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
aws_image_builder_flavor
AWS Code Build image builder flavor.
AWSImageBuilderConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseImageBuilderConfig
AWS Code Build image builder configuration.
Attributes:
Name | Type | Description |
---|---|---|
code_build_project |
str
|
The name of an existing AWS CodeBuild project to use to build the image. The CodeBuild project must exist in the AWS account and region inferred from the AWS service connector credentials or implicitly from the local AWS config. |
build_image |
str
|
The Docker image to use for the AWS CodeBuild environment. The image must have Docker installed and be able to run Docker commands. The default image is bentolor/docker-dind-awscli. This can be customized to use a mirror, if needed, in case the Dockerhub image is not accessible or rate-limited. |
custom_env_vars |
Optional[Dict[str, str]]
|
Custom environment variables to pass to the AWS CodeBuild build. |
compute_type |
str
|
The compute type to use for the AWS CodeBuild build. The default is BUILD_GENERAL1_SMALL. |
implicit_container_registry_auth |
bool
|
Whether to use implicit authentication to authenticate the AWS Code Build build to the container registry when pushing container images. If set to False, the container registry credentials must be explicitly configured for the container registry stack component or the container registry stack component must be linked to a service connector. NOTE: When implicit_container_registry_auth is set to False, the container registry credentials will be passed to the AWS Code Build build as environment variables. This is not recommended for production use unless your service connector is configured to generate short-lived credentials. |
Source code in src/zenml/stack/stack_component.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
AWSImageBuilderFlavor
Bases: BaseImageBuilderFlavor
AWS Code Build image builder flavor.
config_class: Type[BaseImageBuilderConfig]
property
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[AWSImageBuilder]
property
logo_url: str
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
str
|
The flavor logo. |
name: str
property
The flavor name.
Returns:
Type | Description |
---|---|
str
|
The name of the flavor. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
sagemaker_orchestrator_flavor
Amazon SageMaker orchestrator flavor.
SagemakerOrchestratorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseOrchestratorConfig
, SagemakerOrchestratorSettings
Config for the Sagemaker orchestrator.
There are three ways to authenticate to AWS:
- By connecting a ServiceConnector
to the orchestrator,
- By configuring explicit AWS credentials aws_access_key_id
,
aws_secret_access_key
, and optional aws_auth_role_arn
,
- If none of the above are provided, unspecified credentials will be
loaded from the default AWS config.
Attributes:
Name | Type | Description |
---|---|---|
execution_role |
str
|
The IAM role ARN to use for the pipeline. |
scheduler_role |
Optional[str]
|
The ARN of the IAM role that will be assumed by the EventBridge service to launch Sagemaker pipelines (For more details regarding the required permissions, please check: https://docs.zenml.io/stack-components/orchestrators/sagemaker#required-iam-permissions-for-schedules) |
aws_access_key_id |
Optional[str]
|
The AWS access key ID to use to authenticate to AWS. If not provided, the value from the default AWS config will be used. |
aws_secret_access_key |
Optional[str]
|
The AWS secret access key to use to authenticate to AWS. If not provided, the value from the default AWS config will be used. |
aws_profile |
Optional[str]
|
The AWS profile to use for authentication if not using service connectors or explicit credentials. If not provided, the default profile will be used. |
aws_auth_role_arn |
Optional[str]
|
The ARN of an intermediate IAM role to assume when authenticating to AWS. |
region |
Optional[str]
|
The AWS region where the processing job will be run. If not provided, the value from the default AWS config will be used. |
bucket |
Optional[str]
|
Name of the S3 bucket to use for storing artifacts from the job run. If not provided, a default bucket will be created based on the following format: "sagemaker-{region}-{aws-account-id}". |
Source code in src/zenml/stack/stack_component.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
is_remote: bool
property
Checks if this stack component is running remotely.
This designation is used to determine if the stack component can be used with a local ZenML database or if it requires a remote ZenML server.
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. |
is_synchronous: bool
property
Whether the orchestrator runs synchronous or not.
Returns:
Type | Description |
---|---|
bool
|
Whether the orchestrator runs synchronous or not. |
SagemakerOrchestratorFlavor
Bases: BaseOrchestratorFlavor
Flavor for the Sagemaker orchestrator.
config_class: Type[SagemakerOrchestratorConfig]
property
Returns SagemakerOrchestratorConfig config class.
Returns:
Type | Description |
---|---|
Type[SagemakerOrchestratorConfig]
|
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[SagemakerOrchestrator]
property
Implementation class.
Returns:
Type | Description |
---|---|
Type[SagemakerOrchestrator]
|
The implementation class. |
logo_url: str
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
str
|
The flavor logo. |
name: str
property
Name of the flavor.
Returns:
Type | Description |
---|---|
str
|
The name of the flavor. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
SagemakerOrchestratorSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseSettings
Settings for the Sagemaker orchestrator.
Attributes:
Name | Type | Description |
---|---|---|
synchronous |
bool
|
If |
instance_type |
Optional[str]
|
The instance type to use for the processing job. |
execution_role |
Optional[str]
|
The IAM role to use for the step execution. |
processor_role |
Optional[str]
|
DEPRECATED: use |
volume_size_in_gb |
int
|
The size of the EBS volume to use for the processing job. |
max_runtime_in_seconds |
int
|
The maximum runtime in seconds for the processing job. |
tags |
Dict[str, str]
|
Tags to apply to the Processor/Estimator assigned to the step. |
pipeline_tags |
Dict[str, str]
|
Tags to apply to the pipeline via the sagemaker.workflow.pipeline.Pipeline.create method. |
processor_tags |
Dict[str, str]
|
DEPRECATED: use |
keep_alive_period_in_seconds |
Optional[int]
|
The time in seconds after which the
provisioned instance will be terminated if not used. This is only
applicable for TrainingStep type and it is not possible to use
TrainingStep type if the |
use_training_step |
Optional[bool]
|
Whether to use the TrainingStep type.
It is not possible to use TrainingStep type
if the |
processor_args |
Dict[str, Any]
|
Arguments that are directly passed to the SageMaker Processor for a specific step, allowing for overriding the default settings provided when configuring the component. See https://sagemaker.readthedocs.io/en/stable/api/training/processing.html#sagemaker.processing.Processor for a full list of arguments. For processor_args.instance_type, check https://docs.aws.amazon.com/sagemaker/latest/dg/notebooks-available-instance-types.html for a list of available instance types. |
environment |
Dict[str, str]
|
Environment variables to pass to the container. |
estimator_args |
Dict[str, Any]
|
Arguments that are directly passed to the SageMaker Estimator for a specific step, allowing for overriding the default settings provided when configuring the component. See https://sagemaker.readthedocs.io/en/stable/api/training/estimators.html#sagemaker.estimator.Estimator for a full list of arguments. For a list of available instance types, check https://docs.aws.amazon.com/sagemaker/latest/dg/cmn-info-instance-types.html. |
input_data_s3_mode |
str
|
How data is made available to the container. Two possible input modes: File, Pipe. |
input_data_s3_uri |
Optional[Union[str, Dict[str, str]]]
|
S3 URI where data is located if not locally, e.g. s3://my-bucket/my-data/train. How data will be made available to the container is configured with input_data_s3_mode. Two possible input types: - str: S3 location where training data is saved. - Dict[str, str]: (ChannelName, S3Location) which represent - Dict[str, str]: (ChannelName, S3Location) which represent channels (e.g. training, validation, testing) where specific parts of the data are saved in S3. |
output_data_s3_mode |
str
|
How data is uploaded to the S3 bucket. Two possible output modes: EndOfJob, Continuous. |
output_data_s3_uri |
Optional[Union[str, Dict[str, str]]]
|
S3 URI where data is uploaded after or during processing run.
e.g. s3://my-bucket/my-data/output. How data will be made available
to the container is configured with output_data_s3_mode. Two possible
input types:
- str: S3 location where data will be uploaded from a local folder
named /opt/ml/processing/output/data.
- Dict[str, str]: (ChannelName, S3Location) which represent
channels (e.g. output_one, output_two) where
specific parts of the data are stored locally for S3 upload.
Data must be available locally in /opt/ml/processing/output/data/ |
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 |
|
validate_model(data: Dict[str, Any]) -> Dict[str, Any]
Check if model is configured correctly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Dict[str, Any]
|
The model data. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The validated model data. |
Raises:
Type | Description |
---|---|
ValueError
|
If the model is configured incorrectly. |
Source code in src/zenml/integrations/aws/flavors/sagemaker_orchestrator_flavor.py
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 |
|
sagemaker_step_operator_flavor
Amazon SageMaker step operator flavor.
SagemakerStepOperatorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseStepOperatorConfig
, SagemakerStepOperatorSettings
Config for the Sagemaker step operator.
Attributes:
Name | Type | Description |
---|---|---|
role |
str
|
The role that has to be assigned to the jobs which are running in Sagemaker. |
bucket |
Optional[str]
|
Name of the S3 bucket to use for storing artifacts from the job run. If not provided, a default bucket will be created based on the following format: "sagemaker-{region}-{aws-account-id}". |
Source code in src/zenml/stack/stack_component.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
is_remote: bool
property
Checks if this stack component is running remotely.
This designation is used to determine if the stack component can be used with a local ZenML database or if it requires a remote ZenML server.
Returns:
Type | Description |
---|---|
bool
|
True if this config is for a remote component, False otherwise. |
SagemakerStepOperatorFlavor
Bases: BaseStepOperatorFlavor
Flavor for the Sagemaker step operator.
config_class: Type[SagemakerStepOperatorConfig]
property
Returns SagemakerStepOperatorConfig config class.
Returns:
Type | Description |
---|---|
Type[SagemakerStepOperatorConfig]
|
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[SagemakerStepOperator]
property
Implementation class.
Returns:
Type | Description |
---|---|
Type[SagemakerStepOperator]
|
The implementation class. |
logo_url: str
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
str
|
The flavor logo. |
name: str
property
Name of the flavor.
Returns:
Type | Description |
---|---|
str
|
The name of the flavor. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
SagemakerStepOperatorSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseSettings
Settings for the Sagemaker step operator.
Attributes:
Name | Type | Description |
---|---|---|
experiment_name |
Optional[str]
|
The name for the experiment to which the job will be associated. If not provided, the job runs would be independent. |
input_data_s3_uri |
Optional[Union[str, Dict[str, str]]]
|
S3 URI where training data is located if not locally, e.g. s3://my-bucket/my-data/train. How data will be made available to the container is configured with estimator_args.input_mode. Two possible input types: - str: S3 location where training data is saved. - Dict[str, str]: (ChannelName, S3Location) which represent channels (e.g. training, validation, testing) where specific parts of the data are saved in S3. |
estimator_args |
Dict[str, Any]
|
Arguments that are directly passed to the SageMaker Estimator. See https://sagemaker.readthedocs.io/en/stable/api/training/estimators.html#sagemaker.estimator.Estimator for a full list of arguments. For estimator_args.instance_type, check https://docs.aws.amazon.com/sagemaker/latest/dg/notebooks-available-instance-types.html for a list of available instance types. |
environment |
Dict[str, str]
|
Environment variables to pass to the container. |
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 |
|
image_builders
Initialization for the AWS image builder.
Classes
AWSImageBuilder(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, labels: Optional[Dict[str, Any]] = None, connector_requirements: Optional[ServiceConnectorRequirements] = None, connector: Optional[UUID] = None, connector_resource_id: Optional[str] = None, *args: Any, **kwargs: Any)
Bases: BaseImageBuilder
AWS Code Build image builder implementation.
Source code in src/zenml/stack/stack_component.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
code_build_client: Any
property
The authenticated AWS Code Build client to use for interacting with AWS services.
Returns:
Type | Description |
---|---|
Any
|
The authenticated AWS Code Build client. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the AWS Code Build client cannot be created. |
config: AWSImageBuilderConfig
property
The stack component configuration.
Returns:
Type | Description |
---|---|
AWSImageBuilderConfig
|
The configuration. |
is_building_locally: bool
property
Whether the image builder builds the images on the client machine.
Returns:
Type | Description |
---|---|
bool
|
True if the image builder builds locally, False otherwise. |
validator: Optional[StackValidator]
property
Validates the stack for the AWS Code Build Image Builder.
The AWS Code Build Image Builder requires a container registry to push the image to and an S3 Artifact Store to upload the build context, so AWS Code Build can access it.
Returns:
Type | Description |
---|---|
Optional[StackValidator]
|
Stack validator. |
build(image_name: str, build_context: BuildContext, docker_build_options: Dict[str, Any], container_registry: Optional[BaseContainerRegistry] = None) -> str
Builds and pushes a Docker image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_name
|
str
|
Name of the image to build and push. |
required |
build_context
|
BuildContext
|
The build context to use for the image. |
required |
docker_build_options
|
Dict[str, Any]
|
Docker build options. |
required |
container_registry
|
Optional[BaseContainerRegistry]
|
Optional container registry to push to. |
None
|
Returns:
Type | Description |
---|---|
str
|
The Docker image name with digest. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If no container registry is passed. |
RuntimeError
|
If the Cloud Build build fails. |
Source code in src/zenml/integrations/aws/image_builders/aws_image_builder.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 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 |
|
Modules
aws_image_builder
AWS Code Build image builder implementation.
AWSImageBuilder(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, labels: Optional[Dict[str, Any]] = None, connector_requirements: Optional[ServiceConnectorRequirements] = None, connector: Optional[UUID] = None, connector_resource_id: Optional[str] = None, *args: Any, **kwargs: Any)
Bases: BaseImageBuilder
AWS Code Build image builder implementation.
Source code in src/zenml/stack/stack_component.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
code_build_client: Any
property
The authenticated AWS Code Build client to use for interacting with AWS services.
Returns:
Type | Description |
---|---|
Any
|
The authenticated AWS Code Build client. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the AWS Code Build client cannot be created. |
config: AWSImageBuilderConfig
property
The stack component configuration.
Returns:
Type | Description |
---|---|
AWSImageBuilderConfig
|
The configuration. |
is_building_locally: bool
property
Whether the image builder builds the images on the client machine.
Returns:
Type | Description |
---|---|
bool
|
True if the image builder builds locally, False otherwise. |
validator: Optional[StackValidator]
property
Validates the stack for the AWS Code Build Image Builder.
The AWS Code Build Image Builder requires a container registry to push the image to and an S3 Artifact Store to upload the build context, so AWS Code Build can access it.
Returns:
Type | Description |
---|---|
Optional[StackValidator]
|
Stack validator. |
build(image_name: str, build_context: BuildContext, docker_build_options: Dict[str, Any], container_registry: Optional[BaseContainerRegistry] = None) -> str
Builds and pushes a Docker image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_name
|
str
|
Name of the image to build and push. |
required |
build_context
|
BuildContext
|
The build context to use for the image. |
required |
docker_build_options
|
Dict[str, Any]
|
Docker build options. |
required |
container_registry
|
Optional[BaseContainerRegistry]
|
Optional container registry to push to. |
None
|
Returns:
Type | Description |
---|---|
str
|
The Docker image name with digest. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If no container registry is passed. |
RuntimeError
|
If the Cloud Build build fails. |
Source code in src/zenml/integrations/aws/image_builders/aws_image_builder.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 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 |
|
orchestrators
AWS Sagemaker orchestrator.
Classes
SagemakerOrchestrator(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, labels: Optional[Dict[str, Any]] = None, connector_requirements: Optional[ServiceConnectorRequirements] = None, connector: Optional[UUID] = None, connector_resource_id: Optional[str] = None, *args: Any, **kwargs: Any)
Bases: ContainerizedOrchestrator
Orchestrator responsible for running pipelines on Sagemaker.
Source code in src/zenml/stack/stack_component.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
config: SagemakerOrchestratorConfig
property
Returns the SagemakerOrchestratorConfig
config.
Returns:
Type | Description |
---|---|
SagemakerOrchestratorConfig
|
The configuration. |
settings_class: Optional[Type[BaseSettings]]
property
Settings class for the Sagemaker orchestrator.
Returns:
Type | Description |
---|---|
Optional[Type[BaseSettings]]
|
The settings class. |
validator: Optional[StackValidator]
property
Validates the stack.
In the remote case, checks that the stack contains a container registry, image builder and only remote components.
Returns:
Type | Description |
---|---|
Optional[StackValidator]
|
A |
compute_metadata(execution_arn: str, settings: SagemakerOrchestratorSettings) -> Iterator[Dict[str, MetadataType]]
Generate run metadata based on the generated Sagemaker Execution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
execution_arn
|
str
|
The ARN of the pipeline execution. |
required |
settings
|
SagemakerOrchestratorSettings
|
The Sagemaker orchestrator settings. |
required |
Yields:
Type | Description |
---|---|
Dict[str, MetadataType]
|
A dictionary of metadata related to the pipeline run. |
Source code in src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 |
|
fetch_status(run: PipelineRunResponse) -> ExecutionStatus
Refreshes the status of a specific pipeline run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run
|
PipelineRunResponse
|
The run that was executed by this orchestrator. |
required |
Returns:
Type | Description |
---|---|
ExecutionStatus
|
the actual status of the pipeline job. |
Raises:
Type | Description |
---|---|
AssertionError
|
If the run was not executed by to this orchestrator. |
ValueError
|
If it fetches an unknown state or if we can not fetch the orchestrator run ID. |
Source code in src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 |
|
generate_schedule_metadata(schedule_arn: str) -> Dict[str, str]
staticmethod
Attaches metadata to the ZenML Schedules.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_arn
|
str
|
The trigger ARNs that is generated on the AWS side. |
required |
Returns:
Type | Description |
---|---|
Dict[str, str]
|
a dictionary containing metadata related to the schedule. |
Source code in src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py
937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 |
|
get_orchestrator_run_id() -> str
Returns the run id of the active orchestrator run.
Important: This needs to be a unique ID and return the same value for all steps of a pipeline run.
Returns:
Type | Description |
---|---|
str
|
The orchestrator run id. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the run id cannot be read from the environment. |
Source code in src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
|
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/aws/orchestrators/sagemaker_orchestrator.py
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 |
|
prepare_or_run_pipeline(deployment: PipelineDeploymentResponse, stack: Stack, environment: Dict[str, str], placeholder_run: Optional[PipelineRunResponse] = None) -> Iterator[Dict[str, MetadataType]]
Prepares or runs a pipeline on Sagemaker.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
PipelineDeploymentResponse
|
The deployment to prepare or run. |
required |
stack
|
Stack
|
The stack to run on. |
required |
environment
|
Dict[str, str]
|
Environment variables to set in the orchestration environment. |
required |
placeholder_run
|
Optional[PipelineRunResponse]
|
An optional placeholder run for the deployment. |
None
|
Raises:
Type | Description |
---|---|
RuntimeError
|
If there is an error creating or scheduling the pipeline. |
TypeError
|
If the network_config passed is not compatible with the AWS SageMaker NetworkConfig class. |
ValueError
|
If the schedule is not valid. |
Yields:
Type | Description |
---|---|
Dict[str, MetadataType]
|
A dictionary of metadata related to the pipeline run. |
Source code in src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 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 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 |
|
Modules
sagemaker_orchestrator
Implementation of the SageMaker orchestrator.
SagemakerOrchestrator(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, labels: Optional[Dict[str, Any]] = None, connector_requirements: Optional[ServiceConnectorRequirements] = None, connector: Optional[UUID] = None, connector_resource_id: Optional[str] = None, *args: Any, **kwargs: Any)
Bases: ContainerizedOrchestrator
Orchestrator responsible for running pipelines on Sagemaker.
Source code in src/zenml/stack/stack_component.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
config: SagemakerOrchestratorConfig
property
Returns the SagemakerOrchestratorConfig
config.
Returns:
Type | Description |
---|---|
SagemakerOrchestratorConfig
|
The configuration. |
settings_class: Optional[Type[BaseSettings]]
property
Settings class for the Sagemaker orchestrator.
Returns:
Type | Description |
---|---|
Optional[Type[BaseSettings]]
|
The settings class. |
validator: Optional[StackValidator]
property
Validates the stack.
In the remote case, checks that the stack contains a container registry, image builder and only remote components.
Returns:
Type | Description |
---|---|
Optional[StackValidator]
|
A |
compute_metadata(execution_arn: str, settings: SagemakerOrchestratorSettings) -> Iterator[Dict[str, MetadataType]]
Generate run metadata based on the generated Sagemaker Execution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
execution_arn
|
str
|
The ARN of the pipeline execution. |
required |
settings
|
SagemakerOrchestratorSettings
|
The Sagemaker orchestrator settings. |
required |
Yields:
Type | Description |
---|---|
Dict[str, MetadataType]
|
A dictionary of metadata related to the pipeline run. |
Source code in src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 |
|
fetch_status(run: PipelineRunResponse) -> ExecutionStatus
Refreshes the status of a specific pipeline run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run
|
PipelineRunResponse
|
The run that was executed by this orchestrator. |
required |
Returns:
Type | Description |
---|---|
ExecutionStatus
|
the actual status of the pipeline job. |
Raises:
Type | Description |
---|---|
AssertionError
|
If the run was not executed by to this orchestrator. |
ValueError
|
If it fetches an unknown state or if we can not fetch the orchestrator run ID. |
Source code in src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 |
|
generate_schedule_metadata(schedule_arn: str) -> Dict[str, str]
staticmethod
Attaches metadata to the ZenML Schedules.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_arn
|
str
|
The trigger ARNs that is generated on the AWS side. |
required |
Returns:
Type | Description |
---|---|
Dict[str, str]
|
a dictionary containing metadata related to the schedule. |
Source code in src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py
937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 |
|
get_orchestrator_run_id() -> str
Returns the run id of the active orchestrator run.
Important: This needs to be a unique ID and return the same value for all steps of a pipeline run.
Returns:
Type | Description |
---|---|
str
|
The orchestrator run id. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the run id cannot be read from the environment. |
Source code in src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
|
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/aws/orchestrators/sagemaker_orchestrator.py
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 |
|
prepare_or_run_pipeline(deployment: PipelineDeploymentResponse, stack: Stack, environment: Dict[str, str], placeholder_run: Optional[PipelineRunResponse] = None) -> Iterator[Dict[str, MetadataType]]
Prepares or runs a pipeline on Sagemaker.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
PipelineDeploymentResponse
|
The deployment to prepare or run. |
required |
stack
|
Stack
|
The stack to run on. |
required |
environment
|
Dict[str, str]
|
Environment variables to set in the orchestration environment. |
required |
placeholder_run
|
Optional[PipelineRunResponse]
|
An optional placeholder run for the deployment. |
None
|
Raises:
Type | Description |
---|---|
RuntimeError
|
If there is an error creating or scheduling the pipeline. |
TypeError
|
If the network_config passed is not compatible with the AWS SageMaker NetworkConfig class. |
ValueError
|
If the schedule is not valid. |
Yields:
Type | Description |
---|---|
Dict[str, MetadataType]
|
A dictionary of metadata related to the pipeline run. |
Source code in src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 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 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 |
|
dissect_pipeline_execution_arn(pipeline_execution_arn: str) -> Tuple[Optional[str], Optional[str], Optional[str]]
Extract region name, pipeline name, and execution id from the ARN.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline_execution_arn
|
str
|
the pipeline execution ARN |
required |
Returns:
Type | Description |
---|---|
Tuple[Optional[str], Optional[str], Optional[str]]
|
Region Name, Pipeline Name, Execution ID in order |
Source code in src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py
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 |
|
dissect_schedule_arn(schedule_arn: str) -> Tuple[Optional[str], Optional[str]]
Extracts the region and the name from an EventBridge schedule ARN.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule_arn
|
str
|
The ARN of the EventBridge schedule. |
required |
Returns:
Type | Description |
---|---|
Tuple[Optional[str], Optional[str]]
|
Region Name, Schedule Name (including the group name) |
Raises:
Type | Description |
---|---|
ValueError
|
If the input is not a properly formatted ARN. |
Source code in src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py
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 |
|
sagemaker_orchestrator_entrypoint_config
Entrypoint configuration for ZenML Sagemaker pipeline steps.
SagemakerEntrypointConfiguration(arguments: List[str])
Bases: StepEntrypointConfiguration
Entrypoint configuration for ZenML Sagemaker pipeline steps.
The only purpose of this entrypoint configuration is to reconstruct the environment variables that exceed the maximum length of 256 characters allowed for Sagemaker Processor steps from their individual components.
Source code in src/zenml/entrypoints/base_entrypoint_configuration.py
60 61 62 63 64 65 66 |
|
run() -> None
Runs the step.
Source code in src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator_entrypoint_config.py
32 33 34 35 36 37 38 39 |
|
service_connectors
AWS Service Connector.
Classes
AWSServiceConnector(**kwargs: Any)
Bases: ServiceConnector
AWS service connector.
Source code in src/zenml/service_connectors/service_connector.py
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 |
|
account_id: str
property
Get the AWS account ID.
Returns:
Type | Description |
---|---|
str
|
The AWS account ID. |
Raises:
Type | Description |
---|---|
AuthorizationException
|
If the AWS account ID could not be determined. |
get_boto3_session(auth_method: str, resource_type: Optional[str] = None, resource_id: Optional[str] = None) -> Tuple[boto3.Session, Optional[datetime.datetime]]
Get a boto3 session for the specified resource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
auth_method
|
str
|
The authentication method to use. |
required |
resource_type
|
Optional[str]
|
The resource type to get a boto3 session for. |
None
|
resource_id
|
Optional[str]
|
The resource ID to get a boto3 session for. |
None
|
Returns:
Type | Description |
---|---|
Session
|
A boto3 session for the specified resource and its expiration |
Optional[datetime]
|
timestamp, if applicable. |
Source code in src/zenml/integrations/aws/service_connectors/aws_service_connector.py
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 |
|
get_ecr_client() -> BaseClient
Get an ECR client.
Raises:
Type | Description |
---|---|
ValueError
|
If the service connector is not able to instantiate an ECR client. |
Returns:
Type | Description |
---|---|
BaseClient
|
An ECR client. |
Source code in src/zenml/integrations/aws/service_connectors/aws_service_connector.py
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 |
|
Modules
aws_service_connector
AWS Service Connector.
The AWS Service Connector implements various authentication methods for AWS services:
- Explicit AWS secret key (access key, secret key)
- Explicit AWS STS tokens (access key, secret key, session token)
- IAM roles (i.e. generating temporary STS tokens on the fly by assuming an IAM role)
- IAM user federation tokens
- STS Session tokens
AWSAuthenticationMethods
AWSBaseConfig
AWSImplicitConfig
AWSSecretKey
AWSSecretKeyConfig
AWSServiceConnector(**kwargs: Any)
Bases: ServiceConnector
AWS service connector.
Source code in src/zenml/service_connectors/service_connector.py
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 |
|
account_id: str
property
Get the AWS account ID.
Returns:
Type | Description |
---|---|
str
|
The AWS account ID. |
Raises:
Type | Description |
---|---|
AuthorizationException
|
If the AWS account ID could not be determined. |
get_boto3_session(auth_method: str, resource_type: Optional[str] = None, resource_id: Optional[str] = None) -> Tuple[boto3.Session, Optional[datetime.datetime]]
Get a boto3 session for the specified resource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
auth_method
|
str
|
The authentication method to use. |
required |
resource_type
|
Optional[str]
|
The resource type to get a boto3 session for. |
None
|
resource_id
|
Optional[str]
|
The resource ID to get a boto3 session for. |
None
|
Returns:
Type | Description |
---|---|
Session
|
A boto3 session for the specified resource and its expiration |
Optional[datetime]
|
timestamp, if applicable. |
Source code in src/zenml/integrations/aws/service_connectors/aws_service_connector.py
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 |
|
get_ecr_client() -> BaseClient
Get an ECR client.
Raises:
Type | Description |
---|---|
ValueError
|
If the service connector is not able to instantiate an ECR client. |
Returns:
Type | Description |
---|---|
BaseClient
|
An ECR client. |
Source code in src/zenml/integrations/aws/service_connectors/aws_service_connector.py
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 |
|
AWSSessionPolicy
FederationTokenAuthenticationConfig
IAMRoleAuthenticationConfig
STSToken
STSTokenConfig
SessionTokenAuthenticationConfig
step_operators
Initialization of the Sagemaker Step Operator.
Classes
SagemakerStepOperator(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, labels: Optional[Dict[str, Any]] = None, connector_requirements: Optional[ServiceConnectorRequirements] = None, connector: Optional[UUID] = None, connector_resource_id: Optional[str] = None, *args: Any, **kwargs: Any)
Bases: BaseStepOperator
Step operator to run a step on Sagemaker.
This class defines code that builds an image with the ZenML entrypoint to run using Sagemaker's Estimator.
Source code in src/zenml/stack/stack_component.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
config: SagemakerStepOperatorConfig
property
Returns the SagemakerStepOperatorConfig
config.
Returns:
Type | Description |
---|---|
SagemakerStepOperatorConfig
|
The configuration. |
entrypoint_config_class: Type[StepOperatorEntrypointConfiguration]
property
Returns the entrypoint configuration class for this step operator.
Returns:
Type | Description |
---|---|
Type[StepOperatorEntrypointConfiguration]
|
The entrypoint configuration class for this step operator. |
settings_class: Optional[Type[BaseSettings]]
property
Settings class for the SageMaker step operator.
Returns:
Type | Description |
---|---|
Optional[Type[BaseSettings]]
|
The settings class. |
validator: Optional[StackValidator]
property
Validates the stack.
Returns:
Type | Description |
---|---|
Optional[StackValidator]
|
A validator that checks that the stack contains a remote container |
Optional[StackValidator]
|
registry and a remote artifact store. |
get_docker_builds(deployment: PipelineDeploymentBase) -> List[BuildConfiguration]
Gets the Docker builds required for the component.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
PipelineDeploymentBase
|
The pipeline deployment for which to get the builds. |
required |
Returns:
Type | Description |
---|---|
List[BuildConfiguration]
|
The required Docker builds. |
Source code in src/zenml/integrations/aws/step_operators/sagemaker_step_operator.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
|
launch(info: StepRunInfo, entrypoint_command: List[str], environment: Dict[str, str]) -> None
Launches a step on SageMaker.
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 |
---|---|
RuntimeError
|
If the connector returns an object that is not a
|
Source code in src/zenml/integrations/aws/step_operators/sagemaker_step_operator.py
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 |
|
Modules
sagemaker_step_operator
Implementation of the Sagemaker Step Operator.
SagemakerStepOperator(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, labels: Optional[Dict[str, Any]] = None, connector_requirements: Optional[ServiceConnectorRequirements] = None, connector: Optional[UUID] = None, connector_resource_id: Optional[str] = None, *args: Any, **kwargs: Any)
Bases: BaseStepOperator
Step operator to run a step on Sagemaker.
This class defines code that builds an image with the ZenML entrypoint to run using Sagemaker's Estimator.
Source code in src/zenml/stack/stack_component.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
config: SagemakerStepOperatorConfig
property
Returns the SagemakerStepOperatorConfig
config.
Returns:
Type | Description |
---|---|
SagemakerStepOperatorConfig
|
The configuration. |
entrypoint_config_class: Type[StepOperatorEntrypointConfiguration]
property
Returns the entrypoint configuration class for this step operator.
Returns:
Type | Description |
---|---|
Type[StepOperatorEntrypointConfiguration]
|
The entrypoint configuration class for this step operator. |
settings_class: Optional[Type[BaseSettings]]
property
Settings class for the SageMaker step operator.
Returns:
Type | Description |
---|---|
Optional[Type[BaseSettings]]
|
The settings class. |
validator: Optional[StackValidator]
property
Validates the stack.
Returns:
Type | Description |
---|---|
Optional[StackValidator]
|
A validator that checks that the stack contains a remote container |
Optional[StackValidator]
|
registry and a remote artifact store. |
get_docker_builds(deployment: PipelineDeploymentBase) -> List[BuildConfiguration]
Gets the Docker builds required for the component.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
PipelineDeploymentBase
|
The pipeline deployment for which to get the builds. |
required |
Returns:
Type | Description |
---|---|
List[BuildConfiguration]
|
The required Docker builds. |
Source code in src/zenml/integrations/aws/step_operators/sagemaker_step_operator.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
|
launch(info: StepRunInfo, entrypoint_command: List[str], environment: Dict[str, str]) -> None
Launches a step on SageMaker.
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 |
---|---|
RuntimeError
|
If the connector returns an object that is not a
|
Source code in src/zenml/integrations/aws/step_operators/sagemaker_step_operator.py
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 |
|
sagemaker_step_operator_entrypoint_config
Entrypoint configuration for ZenML Sagemaker step operator.
SagemakerEntrypointConfiguration(arguments: List[str])
Bases: StepOperatorEntrypointConfiguration
Entrypoint configuration for ZenML Sagemaker step operator.
The only purpose of this entrypoint configuration is to reconstruct the environment variables that exceed the maximum length of 512 characters allowed for Sagemaker Estimator steps from their individual components.
Source code in src/zenml/entrypoints/base_entrypoint_configuration.py
60 61 62 63 64 65 66 |
|
run() -> None
Runs the step.
Source code in src/zenml/integrations/aws/step_operators/sagemaker_step_operator_entrypoint_config.py
32 33 34 35 36 37 38 39 |
|