Gcp
zenml.integrations.gcp
Initialization of the GCP ZenML integration.
The GCP integration submodule provides a way to run ZenML pipelines in a cloud
environment. Specifically, it allows the use of cloud artifact stores
and provides an io
module to handle file operations on Google Cloud Storage
(GCS).
The Vertex AI integration submodule provides a way to run ZenML pipelines in a Vertex AI environment.
Attributes
GCP = 'gcp'
module-attribute
GCP_ARTIFACT_STORE_FLAVOR = 'gcp'
module-attribute
GCP_CONNECTOR_TYPE = 'gcp'
module-attribute
GCP_IMAGE_BUILDER_FLAVOR = 'gcp'
module-attribute
GCP_RESOURCE_TYPE = 'gcp-generic'
module-attribute
GCP_VERTEX_EXPERIMENT_TRACKER_FLAVOR = 'vertex'
module-attribute
GCP_VERTEX_ORCHESTRATOR_FLAVOR = 'vertex'
module-attribute
GCP_VERTEX_STEP_OPERATOR_FLAVOR = 'vertex'
module-attribute
GCS_RESOURCE_TYPE = 'gcs-bucket'
module-attribute
Classes
Flavor
Class for ZenML Flavors.
Attributes
config_class: Type[StackComponentConfig]
abstractmethod
property
Returns StackComponentConfig
config class.
Returns:
Type | Description |
---|---|
Type[StackComponentConfig]
|
The config class. |
config_schema: Dict[str, Any]
property
The config schema for a flavor.
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The config schema. |
docs_url: Optional[str]
property
A url to point at docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor docs url. |
implementation_class: Type[StackComponent]
abstractmethod
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[StackComponent]
|
The implementation class for this flavor. |
logo_url: Optional[str]
property
A url to represent the flavor in the dashboard.
Returns:
Type | Description |
---|---|
Optional[str]
|
The flavor logo. |
name: str
abstractmethod
property
The flavor name.
Returns:
Type | Description |
---|---|
str
|
The flavor name. |
sdk_docs_url: Optional[str]
property
A url to point at SDK docs explaining this flavor.
Returns:
Type | Description |
---|---|
Optional[str]
|
A flavor SDK docs url. |
service_connector_requirements: Optional[ServiceConnectorRequirements]
property
Service connector resource requirements for service connectors.
Specifies resource requirements that are used to filter the available service connector types that are compatible with this flavor.
Returns:
Type | Description |
---|---|
Optional[ServiceConnectorRequirements]
|
Requirements for compatible service connectors, if a service |
Optional[ServiceConnectorRequirements]
|
connector is required for this flavor. |
type: StackComponentType
abstractmethod
property
Functions
from_model(flavor_model: FlavorResponse) -> Flavor
classmethod
Loads a flavor from a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flavor_model
|
FlavorResponse
|
The model to load from. |
required |
Raises:
Type | Description |
---|---|
CustomFlavorImportError
|
If the custom flavor can't be imported. |
ImportError
|
If the flavor can't be imported. |
Returns:
Type | Description |
---|---|
Flavor
|
The loaded flavor. |
Source code in src/zenml/stack/flavor.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
generate_default_docs_url() -> str
Generate the doc urls for all inbuilt and integration flavors.
Note that this method is not going to be useful for custom flavors, which do not have any docs in the main zenml docs.
Returns:
Type | Description |
---|---|
str
|
The complete url to the zenml documentation |
Source code in src/zenml/stack/flavor.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
|
generate_default_sdk_docs_url() -> str
Generate SDK docs url for a flavor.
Returns:
Type | Description |
---|---|
str
|
The complete url to the zenml SDK docs |
Source code in src/zenml/stack/flavor.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
|
to_model(integration: Optional[str] = None, is_custom: bool = True) -> FlavorRequest
Converts a flavor to a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
integration
|
Optional[str]
|
The integration to use for the model. |
None
|
is_custom
|
bool
|
Whether the flavor is a custom flavor. |
True
|
Returns:
Type | Description |
---|---|
FlavorRequest
|
The model. |
Source code in src/zenml/stack/flavor.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
GcpIntegration
Bases: Integration
Definition of Google Cloud Platform integration for ZenML.
Functions
activate() -> None
classmethod
Activate the GCP integration.
Source code in src/zenml/integrations/gcp/__init__.py
60 61 62 63 |
|
flavors() -> List[Type[Flavor]]
classmethod
Declare the stack component flavors for the GCP integration.
Returns:
Type | Description |
---|---|
List[Type[Flavor]]
|
List of stack component flavors for this integration. |
Source code in src/zenml/integrations/gcp/__init__.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
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
artifact_stores
Initialization of the GCP Artifact Store.
Classes
GCPArtifactStore(*args: Any, **kwargs: Any)
Bases: BaseArtifactStore
, AuthenticationMixin
Artifact Store for Google Cloud Storage based artifacts.
Source code in src/zenml/artifact_stores/base_artifact_store.py
430 431 432 433 434 435 436 437 438 439 440 441 442 |
|
config: GCPArtifactStoreConfig
property
Returns the GCPArtifactStoreConfig
config.
Returns:
Type | Description |
---|---|
GCPArtifactStoreConfig
|
The configuration. |
filesystem: gcsfs.GCSFileSystem
property
The gcsfs filesystem to access this artifact store.
Returns:
Type | Description |
---|---|
GCSFileSystem
|
The gcsfs filesystem to access this artifact store. |
copyfile(src: PathType, dst: PathType, overwrite: bool = False) -> None
Copy a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
src
|
PathType
|
The path to copy from. |
required |
dst
|
PathType
|
The path to copy to. |
required |
overwrite
|
bool
|
If a file already exists at the destination, this
method will overwrite it if overwrite= |
False
|
Raises:
Type | Description |
---|---|
FileExistsError
|
If a file already exists at the destination
and overwrite is not set to |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
exists(path: PathType) -> bool
Check whether a path exists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path to check. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the path exists, False otherwise. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
145 146 147 148 149 150 151 152 153 154 |
|
get_credentials() -> Optional[Union[Dict[str, Any], gcp_credentials.Credentials]]
Returns the credentials for the GCP Artifact Store if configured.
Returns:
Type | Description |
---|---|
Optional[Union[Dict[str, Any], Credentials]]
|
The credentials. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the linked connector returns the wrong type of client. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
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 |
|
glob(pattern: PathType) -> List[PathType]
Return all paths that match the given glob pattern.
The glob pattern may include: - '' to match any number of characters - '?' to match a single character - '[...]' to match one of the characters inside the brackets - '' as the full name of a path component to match to search in subdirectories of any depth (e.g. '/some_dir/*/some_file)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pattern
|
PathType
|
The glob pattern to match, see details above. |
required |
Returns:
Type | Description |
---|---|
List[PathType]
|
A list of paths that match the given glob pattern. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
|
isdir(path: PathType) -> bool
Check whether a path is a directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path to check. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the path is a directory, False otherwise. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
177 178 179 180 181 182 183 184 185 186 |
|
listdir(path: PathType) -> List[PathType]
Return a list of files in a directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path of the directory to list. |
required |
Returns:
Type | Description |
---|---|
List[PathType]
|
A list of paths of files in the directory. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
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 |
|
makedirs(path: PathType) -> None
Create a directory at the given path.
If needed also create missing parent directories.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path of the directory to create. |
required |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
222 223 224 225 226 227 228 229 230 |
|
mkdir(path: PathType) -> None
Create a directory at the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path of the directory to create. |
required |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
232 233 234 235 236 237 238 |
|
open(path: PathType, mode: str = 'r') -> Any
Open a file at the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
Path of the file to open. |
required |
mode
|
str
|
Mode in which to open the file. Currently, only 'rb' and 'wb' to read and write binary files are supported. |
'r'
|
Returns:
Type | Description |
---|---|
Any
|
A file-like object that can be used to read or write to the file. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
remove(path: PathType) -> None
Remove the file at the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path of the file to remove. |
required |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
240 241 242 243 244 245 246 |
|
rename(src: PathType, dst: PathType, overwrite: bool = False) -> None
Rename source file to destination file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
src
|
PathType
|
The path of the file to rename. |
required |
dst
|
PathType
|
The path to rename the source file to. |
required |
overwrite
|
bool
|
If a file already exists at the destination, this
method will overwrite it if overwrite= |
False
|
Raises:
Type | Description |
---|---|
FileExistsError
|
If a file already exists at the destination
and overwrite is not set to |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
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 |
|
rmtree(path: PathType) -> None
Remove the given directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path of the directory to remove. |
required |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
274 275 276 277 278 279 280 |
|
size(path: PathType) -> int
Get the size of a file in bytes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path to the file. |
required |
Returns:
Type | Description |
---|---|
int
|
The size of the file in bytes. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
293 294 295 296 297 298 299 300 301 302 |
|
stat(path: PathType) -> Dict[str, Any]
Return stat info for the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
the path to get stat info for. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dictionary with the stat info. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
282 283 284 285 286 287 288 289 290 291 |
|
walk(top: PathType, topdown: bool = True, onerror: Optional[Callable[..., None]] = None) -> Iterable[Tuple[PathType, List[PathType], List[PathType]]]
Return an iterator that walks the contents of the given directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
top
|
PathType
|
Path of directory to walk. |
required |
topdown
|
bool
|
Unused argument to conform to interface. |
True
|
onerror
|
Optional[Callable[..., None]]
|
Unused argument to conform to interface. |
None
|
Yields:
Type | Description |
---|---|
Iterable[Tuple[PathType, List[PathType], List[PathType]]]
|
An Iterable of Tuples, each of which contain the path of the current |
Iterable[Tuple[PathType, List[PathType], List[PathType]]]
|
directory path, a list of directories inside the current directory |
Iterable[Tuple[PathType, List[PathType], List[PathType]]]
|
and a list of files inside the current directory. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
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 |
|
Modules
gcp_artifact_store
Implementation of the GCP Artifact Store.
GCPArtifactStore(*args: Any, **kwargs: Any)
Bases: BaseArtifactStore
, AuthenticationMixin
Artifact Store for Google Cloud Storage based artifacts.
Source code in src/zenml/artifact_stores/base_artifact_store.py
430 431 432 433 434 435 436 437 438 439 440 441 442 |
|
config: GCPArtifactStoreConfig
property
Returns the GCPArtifactStoreConfig
config.
Returns:
Type | Description |
---|---|
GCPArtifactStoreConfig
|
The configuration. |
filesystem: gcsfs.GCSFileSystem
property
The gcsfs filesystem to access this artifact store.
Returns:
Type | Description |
---|---|
GCSFileSystem
|
The gcsfs filesystem to access this artifact store. |
copyfile(src: PathType, dst: PathType, overwrite: bool = False) -> None
Copy a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
src
|
PathType
|
The path to copy from. |
required |
dst
|
PathType
|
The path to copy to. |
required |
overwrite
|
bool
|
If a file already exists at the destination, this
method will overwrite it if overwrite= |
False
|
Raises:
Type | Description |
---|---|
FileExistsError
|
If a file already exists at the destination
and overwrite is not set to |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
exists(path: PathType) -> bool
Check whether a path exists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path to check. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the path exists, False otherwise. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
145 146 147 148 149 150 151 152 153 154 |
|
get_credentials() -> Optional[Union[Dict[str, Any], gcp_credentials.Credentials]]
Returns the credentials for the GCP Artifact Store if configured.
Returns:
Type | Description |
---|---|
Optional[Union[Dict[str, Any], Credentials]]
|
The credentials. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the linked connector returns the wrong type of client. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
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 |
|
glob(pattern: PathType) -> List[PathType]
Return all paths that match the given glob pattern.
The glob pattern may include: - '' to match any number of characters - '?' to match a single character - '[...]' to match one of the characters inside the brackets - '' as the full name of a path component to match to search in subdirectories of any depth (e.g. '/some_dir/*/some_file)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pattern
|
PathType
|
The glob pattern to match, see details above. |
required |
Returns:
Type | Description |
---|---|
List[PathType]
|
A list of paths that match the given glob pattern. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
|
isdir(path: PathType) -> bool
Check whether a path is a directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path to check. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the path is a directory, False otherwise. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
177 178 179 180 181 182 183 184 185 186 |
|
listdir(path: PathType) -> List[PathType]
Return a list of files in a directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path of the directory to list. |
required |
Returns:
Type | Description |
---|---|
List[PathType]
|
A list of paths of files in the directory. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
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 |
|
makedirs(path: PathType) -> None
Create a directory at the given path.
If needed also create missing parent directories.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path of the directory to create. |
required |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
222 223 224 225 226 227 228 229 230 |
|
mkdir(path: PathType) -> None
Create a directory at the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path of the directory to create. |
required |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
232 233 234 235 236 237 238 |
|
open(path: PathType, mode: str = 'r') -> Any
Open a file at the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
Path of the file to open. |
required |
mode
|
str
|
Mode in which to open the file. Currently, only 'rb' and 'wb' to read and write binary files are supported. |
'r'
|
Returns:
Type | Description |
---|---|
Any
|
A file-like object that can be used to read or write to the file. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
remove(path: PathType) -> None
Remove the file at the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path of the file to remove. |
required |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
240 241 242 243 244 245 246 |
|
rename(src: PathType, dst: PathType, overwrite: bool = False) -> None
Rename source file to destination file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
src
|
PathType
|
The path of the file to rename. |
required |
dst
|
PathType
|
The path to rename the source file to. |
required |
overwrite
|
bool
|
If a file already exists at the destination, this
method will overwrite it if overwrite= |
False
|
Raises:
Type | Description |
---|---|
FileExistsError
|
If a file already exists at the destination
and overwrite is not set to |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
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 |
|
rmtree(path: PathType) -> None
Remove the given directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path of the directory to remove. |
required |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
274 275 276 277 278 279 280 |
|
size(path: PathType) -> int
Get the size of a file in bytes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
The path to the file. |
required |
Returns:
Type | Description |
---|---|
int
|
The size of the file in bytes. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
293 294 295 296 297 298 299 300 301 302 |
|
stat(path: PathType) -> Dict[str, Any]
Return stat info for the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathType
|
the path to get stat info for. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dictionary with the stat info. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
282 283 284 285 286 287 288 289 290 291 |
|
walk(top: PathType, topdown: bool = True, onerror: Optional[Callable[..., None]] = None) -> Iterable[Tuple[PathType, List[PathType], List[PathType]]]
Return an iterator that walks the contents of the given directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
top
|
PathType
|
Path of directory to walk. |
required |
topdown
|
bool
|
Unused argument to conform to interface. |
True
|
onerror
|
Optional[Callable[..., None]]
|
Unused argument to conform to interface. |
None
|
Yields:
Type | Description |
---|---|
Iterable[Tuple[PathType, List[PathType], List[PathType]]]
|
An Iterable of Tuples, each of which contain the path of the current |
Iterable[Tuple[PathType, List[PathType], List[PathType]]]
|
directory path, a list of directories inside the current directory |
Iterable[Tuple[PathType, List[PathType], List[PathType]]]
|
and a list of files inside the current directory. |
Source code in src/zenml/integrations/gcp/artifact_stores/gcp_artifact_store.py
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 |
|
constants
Constants for the VertexAI integration.
experiment_trackers
Initialization for the VertexAI experiment tracker.
Classes
VertexExperimentTracker(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: BaseExperimentTracker
, GoogleCredentialsMixin
Track experiments using VertexAI.
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: VertexExperimentTrackerConfig
property
Returns the VertexExperimentTrackerConfig
config.
Returns:
Type | Description |
---|---|
VertexExperimentTrackerConfig
|
The configuration. |
settings_class: Type[VertexExperimentTrackerSettings]
property
Returns the BaseSettings
settings class.
Returns:
Type | Description |
---|---|
Type[VertexExperimentTrackerSettings]
|
The settings class. |
cleanup_step_run(info: StepRunInfo, step_failed: bool) -> None
Stops the VertexAI run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
info
|
StepRunInfo
|
Info about the step that was executed. |
required |
step_failed
|
bool
|
Whether the step failed or not. |
required |
Source code in src/zenml/integrations/gcp/experiment_trackers/vertex_experiment_tracker.py
202 203 204 205 206 207 208 209 210 211 212 213 214 |
|
get_step_run_metadata(info: StepRunInfo) -> Dict[str, MetadataType]
Get component- and step-specific metadata after a step ran.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
info
|
StepRunInfo
|
Info about the step that was executed. |
required |
Returns:
Type | Description |
---|---|
Dict[str, MetadataType]
|
A dictionary of metadata. |
Source code in src/zenml/integrations/gcp/experiment_trackers/vertex_experiment_tracker.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
prepare_step_run(info: StepRunInfo) -> None
Configures a VertexAI run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
info
|
StepRunInfo
|
Info about the step that will be executed. |
required |
Source code in src/zenml/integrations/gcp/experiment_trackers/vertex_experiment_tracker.py
65 66 67 68 69 70 71 72 73 |
|
Modules
vertex_experiment_tracker
Implementation of the VertexAI experiment tracker for ZenML.
VertexExperimentTracker(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: BaseExperimentTracker
, GoogleCredentialsMixin
Track experiments using VertexAI.
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: VertexExperimentTrackerConfig
property
Returns the VertexExperimentTrackerConfig
config.
Returns:
Type | Description |
---|---|
VertexExperimentTrackerConfig
|
The configuration. |
settings_class: Type[VertexExperimentTrackerSettings]
property
Returns the BaseSettings
settings class.
Returns:
Type | Description |
---|---|
Type[VertexExperimentTrackerSettings]
|
The settings class. |
cleanup_step_run(info: StepRunInfo, step_failed: bool) -> None
Stops the VertexAI run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
info
|
StepRunInfo
|
Info about the step that was executed. |
required |
step_failed
|
bool
|
Whether the step failed or not. |
required |
Source code in src/zenml/integrations/gcp/experiment_trackers/vertex_experiment_tracker.py
202 203 204 205 206 207 208 209 210 211 212 213 214 |
|
get_step_run_metadata(info: StepRunInfo) -> Dict[str, MetadataType]
Get component- and step-specific metadata after a step ran.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
info
|
StepRunInfo
|
Info about the step that was executed. |
required |
Returns:
Type | Description |
---|---|
Dict[str, MetadataType]
|
A dictionary of metadata. |
Source code in src/zenml/integrations/gcp/experiment_trackers/vertex_experiment_tracker.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
prepare_step_run(info: StepRunInfo) -> None
Configures a VertexAI run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
info
|
StepRunInfo
|
Info about the step that will be executed. |
required |
Source code in src/zenml/integrations/gcp/experiment_trackers/vertex_experiment_tracker.py
65 66 67 68 69 70 71 72 73 |
|
flavors
GCP integration flavors.
Classes
GCPArtifactStoreConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseArtifactStoreConfig
, AuthenticationConfigMixin
Configuration for GCP Artifact Store.
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 |
|
GCPArtifactStoreFlavor
Bases: BaseArtifactStoreFlavor
Flavor of the GCP artifact store.
config_class: Type[GCPArtifactStoreConfig]
property
Returns GCPArtifactStoreConfig config class.
Returns:
Type | Description |
---|---|
Type[GCPArtifactStoreConfig]
|
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[GCPArtifactStore]
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[GCPArtifactStore]
|
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. |
GCPImageBuilderConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseImageBuilderConfig
, GoogleCredentialsConfigMixin
Google Cloud Builder image builder configuration.
Attributes:
Name | Type | Description |
---|---|---|
cloud_builder_image |
str
|
The name of the Docker image to use for the build
steps. Defaults to |
network |
str
|
The network name to which the build container will be
attached while building the Docker image. More information about
this:
https://cloud.google.com/build/docs/build-config-file-schema#network.
Defaults to |
build_timeout |
PositiveInt
|
The timeout of the build in seconds. More information
about this parameter:
https://cloud.google.com/build/docs/build-config-file-schema#timeout_2
Defaults to |
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 |
|
GCPImageBuilderFlavor
Bases: BaseImageBuilderFlavor
Google Cloud Builder 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[GCPImageBuilder]
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. |
VertexExperimentTrackerConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseExperimentTrackerConfig
, GoogleCredentialsConfigMixin
, VertexExperimentTrackerSettings
Config for the VertexAI experiment tracker.
Attributes:
Name | Type | Description |
---|---|---|
location |
Optional[str]
|
Optional. The default location to use when making API calls. If not set defaults to us-central1. |
staging_bucket |
Optional[str]
|
Optional. The default staging bucket to use to stage artifacts when making API calls. In the form gs://... |
network |
Optional[str]
|
Optional. The full name of the Compute Engine network to which jobs and resources should be peered. E.g. "projects/12345/global/networks/myVPC". Private services access must already be configured for the network. If specified, all eligible jobs and resources created will be peered with this VPC. |
encryption_spec_key_name |
Optional[str]
|
Optional. The Cloud KMS resource identifier of the customer
managed encryption key used to protect a resource. Has the
form:
|
api_endpoint |
str
|
|
api_key |
str
|
Optional. The API key to use for service calls. NOTE: Not all services support API keys. |
api_transport |
str
|
Optional. The transport method which is either 'grpc' or 'rest'. NOTE: "rest" transport functionality is currently in a beta state (preview). |
request_metadata |
Optional[Dict[str, Any]]
|
Optional. Additional gRPC metadata to send with every client request. |
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 |
|
VertexExperimentTrackerFlavor
Bases: BaseExperimentTrackerFlavor
Flavor for the VertexAI experiment tracker.
config_class: Type[VertexExperimentTrackerConfig]
property
Returns VertexExperimentTrackerConfig
config class.
Returns:
Type | Description |
---|---|
Type[VertexExperimentTrackerConfig]
|
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[VertexExperimentTracker]
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[VertexExperimentTracker]
|
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. |
VertexOrchestratorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseOrchestratorConfig
, GoogleCredentialsConfigMixin
, VertexOrchestratorSettings
Configuration for the Vertex orchestrator.
Attributes:
Name | Type | Description |
---|---|---|
location |
str
|
Name of GCP region where the pipeline job will be executed. Vertex AI Pipelines is available in the following regions: https://cloud.google.com/vertex-ai/docs/general/locations#feature-availability |
pipeline_root |
Optional[str]
|
a Cloud Storage URI that will be used by the Vertex AI
Pipelines. If not provided but the artifact store in the stack used
to execute the pipeline is a
|
encryption_spec_key_name |
Optional[str]
|
The Cloud KMS resource identifier of the
customer managed encryption key used to protect the job. Has the form:
|
workload_service_account |
Optional[str]
|
the service account for workload run-as account. Users submitting jobs must have act-as permission on this run-as account. If not provided, the Compute Engine default service account for the GCP project in which the pipeline is running is used. |
function_service_account |
Optional[str]
|
the service account for cloud function run-as account, for scheduled pipelines. This service account must have the act-as permission on the workload_service_account. If not provided, the Compute Engine default service account for the GCP project in which the pipeline is running is used. |
scheduler_service_account |
Optional[str]
|
the service account used by the Google Cloud Scheduler to trigger and authenticate to the pipeline Cloud Function on a schedule. If not provided, the Compute Engine default service account for the GCP project in which the pipeline is running is used. |
network |
Optional[str]
|
the full name of the Compute Engine Network to which the job
should be peered. For example, |
cpu_limit |
Optional[str]
|
The maximum CPU limit for this operator. This string value can be a number (integer value for number of CPUs) as string, or a number followed by "m", which means 1/1000. You can specify at most 96 CPUs. (see. https://cloud.google.com/vertex-ai/docs/pipelines/machine-types) |
memory_limit |
Optional[str]
|
The maximum memory limit for this operator. This string value can be a number, or a number followed by "K" (kilobyte), "M" (megabyte), or "G" (gigabyte). At most 624GB is supported. |
gpu_limit |
Optional[int]
|
The GPU limit (positive number) for the operator. For more information about GPU resources, see: https://cloud.google.com/vertex-ai/docs/training/configure-compute#specifying_gpus |
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. |
VertexOrchestratorFlavor
Bases: BaseOrchestratorFlavor
Vertex Orchestrator flavor.
config_class: Type[VertexOrchestratorConfig]
property
Returns VertexOrchestratorConfig config class.
Returns:
Type | Description |
---|---|
Type[VertexOrchestratorConfig]
|
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[VertexOrchestrator]
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[VertexOrchestrator]
|
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
Name of the orchestrator flavor.
Returns:
Type | Description |
---|---|
str
|
Name of the orchestrator 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. |
VertexStepOperatorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseStepOperatorConfig
, GoogleCredentialsConfigMixin
, VertexStepOperatorSettings
Configuration for the Vertex step operator.
Attributes:
Name | Type | Description |
---|---|---|
region |
str
|
Region name, e.g., |
encryption_spec_key_name |
Optional[str]
|
Encryption spec key name. |
network |
Optional[str]
|
The full name of the Compute Engine network to which the Job should be peered. For example, projects/12345/global/networks/myVPC |
reserved_ip_ranges |
Optional[str]
|
A list of names for the reserved ip ranges under the VPC network that can be used for this job. If set, we will deploy the job within the provided ip ranges. Otherwise, the job will be deployed to any ip ranges under the provided VPC network. |
service_account |
Optional[str]
|
Specifies the service account for workload run-as account. Users submitting jobs must have act-as permission on this run-as account. |
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. |
VertexStepOperatorFlavor
Bases: BaseStepOperatorFlavor
Vertex Step Operator flavor.
config_class: Type[VertexStepOperatorConfig]
property
Returns VertexStepOperatorConfig
config class.
Returns:
Type | Description |
---|---|
Type[VertexStepOperatorConfig]
|
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[VertexStepOperator]
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[VertexStepOperator]
|
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
|
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
gcp_artifact_store_flavor
GCP artifact store flavor.
GCPArtifactStoreConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseArtifactStoreConfig
, AuthenticationConfigMixin
Configuration for GCP Artifact Store.
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 |
|
GCPArtifactStoreFlavor
Bases: BaseArtifactStoreFlavor
Flavor of the GCP artifact store.
config_class: Type[GCPArtifactStoreConfig]
property
Returns GCPArtifactStoreConfig config class.
Returns:
Type | Description |
---|---|
Type[GCPArtifactStoreConfig]
|
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[GCPArtifactStore]
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[GCPArtifactStore]
|
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. |
gcp_image_builder_flavor
Google Cloud image builder flavor.
GCPImageBuilderConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseImageBuilderConfig
, GoogleCredentialsConfigMixin
Google Cloud Builder image builder configuration.
Attributes:
Name | Type | Description |
---|---|---|
cloud_builder_image |
str
|
The name of the Docker image to use for the build
steps. Defaults to |
network |
str
|
The network name to which the build container will be
attached while building the Docker image. More information about
this:
https://cloud.google.com/build/docs/build-config-file-schema#network.
Defaults to |
build_timeout |
PositiveInt
|
The timeout of the build in seconds. More information
about this parameter:
https://cloud.google.com/build/docs/build-config-file-schema#timeout_2
Defaults to |
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 |
|
GCPImageBuilderFlavor
Bases: BaseImageBuilderFlavor
Google Cloud Builder 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[GCPImageBuilder]
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. |
vertex_experiment_tracker_flavor
Vertex experiment tracker flavor.
VertexExperimentTrackerConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseExperimentTrackerConfig
, GoogleCredentialsConfigMixin
, VertexExperimentTrackerSettings
Config for the VertexAI experiment tracker.
Attributes:
Name | Type | Description |
---|---|---|
location |
Optional[str]
|
Optional. The default location to use when making API calls. If not set defaults to us-central1. |
staging_bucket |
Optional[str]
|
Optional. The default staging bucket to use to stage artifacts when making API calls. In the form gs://... |
network |
Optional[str]
|
Optional. The full name of the Compute Engine network to which jobs and resources should be peered. E.g. "projects/12345/global/networks/myVPC". Private services access must already be configured for the network. If specified, all eligible jobs and resources created will be peered with this VPC. |
encryption_spec_key_name |
Optional[str]
|
Optional. The Cloud KMS resource identifier of the customer
managed encryption key used to protect a resource. Has the
form:
|
api_endpoint |
str
|
|
api_key |
str
|
Optional. The API key to use for service calls. NOTE: Not all services support API keys. |
api_transport |
str
|
Optional. The transport method which is either 'grpc' or 'rest'. NOTE: "rest" transport functionality is currently in a beta state (preview). |
request_metadata |
Optional[Dict[str, Any]]
|
Optional. Additional gRPC metadata to send with every client request. |
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 |
|
VertexExperimentTrackerFlavor
Bases: BaseExperimentTrackerFlavor
Flavor for the VertexAI experiment tracker.
config_class: Type[VertexExperimentTrackerConfig]
property
Returns VertexExperimentTrackerConfig
config class.
Returns:
Type | Description |
---|---|
Type[VertexExperimentTrackerConfig]
|
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[VertexExperimentTracker]
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[VertexExperimentTracker]
|
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. |
VertexExperimentTrackerSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseSettings
Settings for the VertexAI experiment tracker.
Attributes:
Name | Type | Description |
---|---|---|
experiment |
Optional[str]
|
The VertexAI experiment name. |
experiment_tensorboard |
Optional[Union[str, bool]]
|
The VertexAI experiment tensorboard. |
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 |
|
vertex_orchestrator_flavor
Vertex orchestrator flavor.
VertexOrchestratorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseOrchestratorConfig
, GoogleCredentialsConfigMixin
, VertexOrchestratorSettings
Configuration for the Vertex orchestrator.
Attributes:
Name | Type | Description |
---|---|---|
location |
str
|
Name of GCP region where the pipeline job will be executed. Vertex AI Pipelines is available in the following regions: https://cloud.google.com/vertex-ai/docs/general/locations#feature-availability |
pipeline_root |
Optional[str]
|
a Cloud Storage URI that will be used by the Vertex AI
Pipelines. If not provided but the artifact store in the stack used
to execute the pipeline is a
|
encryption_spec_key_name |
Optional[str]
|
The Cloud KMS resource identifier of the
customer managed encryption key used to protect the job. Has the form:
|
workload_service_account |
Optional[str]
|
the service account for workload run-as account. Users submitting jobs must have act-as permission on this run-as account. If not provided, the Compute Engine default service account for the GCP project in which the pipeline is running is used. |
function_service_account |
Optional[str]
|
the service account for cloud function run-as account, for scheduled pipelines. This service account must have the act-as permission on the workload_service_account. If not provided, the Compute Engine default service account for the GCP project in which the pipeline is running is used. |
scheduler_service_account |
Optional[str]
|
the service account used by the Google Cloud Scheduler to trigger and authenticate to the pipeline Cloud Function on a schedule. If not provided, the Compute Engine default service account for the GCP project in which the pipeline is running is used. |
network |
Optional[str]
|
the full name of the Compute Engine Network to which the job
should be peered. For example, |
cpu_limit |
Optional[str]
|
The maximum CPU limit for this operator. This string value can be a number (integer value for number of CPUs) as string, or a number followed by "m", which means 1/1000. You can specify at most 96 CPUs. (see. https://cloud.google.com/vertex-ai/docs/pipelines/machine-types) |
memory_limit |
Optional[str]
|
The maximum memory limit for this operator. This string value can be a number, or a number followed by "K" (kilobyte), "M" (megabyte), or "G" (gigabyte). At most 624GB is supported. |
gpu_limit |
Optional[int]
|
The GPU limit (positive number) for the operator. For more information about GPU resources, see: https://cloud.google.com/vertex-ai/docs/training/configure-compute#specifying_gpus |
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. |
VertexOrchestratorFlavor
Bases: BaseOrchestratorFlavor
Vertex Orchestrator flavor.
config_class: Type[VertexOrchestratorConfig]
property
Returns VertexOrchestratorConfig config class.
Returns:
Type | Description |
---|---|
Type[VertexOrchestratorConfig]
|
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[VertexOrchestrator]
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[VertexOrchestrator]
|
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
Name of the orchestrator flavor.
Returns:
Type | Description |
---|---|
str
|
Name of the orchestrator 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. |
VertexOrchestratorSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseSettings
Settings for the Vertex orchestrator.
Attributes:
Name | Type | Description |
---|---|---|
synchronous |
bool
|
If |
labels |
Dict[str, str]
|
Labels to assign to the pipeline job. |
node_selector_constraint |
Optional[Tuple[str, str]]
|
Each constraint is a key-value pair label. For the container to be eligible to run on a node, the node must have each of the constraints appeared as labels. For example a GPU type can be providing by one of the following tuples: - ("cloud.google.com/gke-accelerator", "NVIDIA_TESLA_A100") - ("cloud.google.com/gke-accelerator", "NVIDIA_TESLA_K80") - ("cloud.google.com/gke-accelerator", "NVIDIA_TESLA_P4") - ("cloud.google.com/gke-accelerator", "NVIDIA_TESLA_P100") - ("cloud.google.com/gke-accelerator", "NVIDIA_TESLA_T4") - ("cloud.google.com/gke-accelerator", "NVIDIA_TESLA_V100") Hint: the selected region (location) must provide the requested accelerator (see https://cloud.google.com/compute/docs/gpus/gpu-regions-zones). |
pod_settings |
Optional[KubernetesPodSettings]
|
Pod settings to apply. |
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 |
|
vertex_step_operator_flavor
Vertex step operator flavor.
VertexStepOperatorConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: BaseStepOperatorConfig
, GoogleCredentialsConfigMixin
, VertexStepOperatorSettings
Configuration for the Vertex step operator.
Attributes:
Name | Type | Description |
---|---|---|
region |
str
|
Region name, e.g., |
encryption_spec_key_name |
Optional[str]
|
Encryption spec key name. |
network |
Optional[str]
|
The full name of the Compute Engine network to which the Job should be peered. For example, projects/12345/global/networks/myVPC |
reserved_ip_ranges |
Optional[str]
|
A list of names for the reserved ip ranges under the VPC network that can be used for this job. If set, we will deploy the job within the provided ip ranges. Otherwise, the job will be deployed to any ip ranges under the provided VPC network. |
service_account |
Optional[str]
|
Specifies the service account for workload run-as account. Users submitting jobs must have act-as permission on this run-as account. |
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. |
VertexStepOperatorFlavor
Bases: BaseStepOperatorFlavor
Vertex Step Operator flavor.
config_class: Type[VertexStepOperatorConfig]
property
Returns VertexStepOperatorConfig
config class.
Returns:
Type | Description |
---|---|
Type[VertexStepOperatorConfig]
|
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[VertexStepOperator]
property
Implementation class for this flavor.
Returns:
Type | Description |
---|---|
Type[VertexStepOperator]
|
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
|
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. |
VertexStepOperatorSettings(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: VertexCustomJobParameters
, BaseSettings
Settings for the Vertex 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 |
|
google_credentials_mixin
Implementation of the Google credentials mixin.
Classes
GoogleCredentialsConfigMixin(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: StackComponentConfig
Config mixin for Google Cloud Platform credentials.
Attributes:
Name | Type | Description |
---|---|---|
project |
Optional[str]
|
GCP project name. If |
service_account_path |
Optional[str]
|
path to the service account credentials file to be used for authentication. If not provided, the default credentials will be used. |
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 |
|
GoogleCredentialsMixin(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: StackComponent
StackComponent mixin to get Google Cloud Platform credentials.
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: GoogleCredentialsConfigMixin
property
Returns the GoogleCredentialsConfigMixin
config.
Returns:
Type | Description |
---|---|
GoogleCredentialsConfigMixin
|
The configuration. |
Functions
image_builders
Initialization for the GCP image builder.
Classes
GCPImageBuilder(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
, GoogleCredentialsMixin
Google Cloud Builder 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 |
|
config: GCPImageBuilderConfig
property
The stack component configuration.
Returns:
Type | Description |
---|---|
GCPImageBuilderConfig
|
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 GCP Image Builder.
The GCP Image Builder requires a remote container registry to push the image to, and a GCP Artifact Store to upload the build context, so Cloud 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/gcp/image_builders/gcp_image_builder.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
Modules
gcp_image_builder
Google Cloud Builder image builder implementation.
GCPImageBuilder(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
, GoogleCredentialsMixin
Google Cloud Builder 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 |
|
config: GCPImageBuilderConfig
property
The stack component configuration.
Returns:
Type | Description |
---|---|
GCPImageBuilderConfig
|
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 GCP Image Builder.
The GCP Image Builder requires a remote container registry to push the image to, and a GCP Artifact Store to upload the build context, so Cloud 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/gcp/image_builders/gcp_image_builder.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
orchestrators
Initialization for the VertexAI orchestrator.
Classes
VertexOrchestrator(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
, GoogleCredentialsMixin
Orchestrator responsible for running pipelines on Vertex AI.
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: VertexOrchestratorConfig
property
Returns the VertexOrchestratorConfig
config.
Returns:
Type | Description |
---|---|
VertexOrchestratorConfig
|
The configuration. |
pipeline_directory: str
property
Returns path to directory where kubeflow pipelines files are stored.
Returns:
Type | Description |
---|---|
str
|
Path to the pipeline directory. |
root_directory: str
property
Returns path to the root directory for files for this orchestrator.
Returns:
Type | Description |
---|---|
str
|
The path to the root directory for all files concerning this |
str
|
orchestrator. |
settings_class: Optional[Type[BaseSettings]]
property
Settings class for the Vertex orchestrator.
Returns:
Type | Description |
---|---|
Optional[Type[BaseSettings]]
|
The settings class. |
validator: Optional[StackValidator]
property
Validates that the stack contains a container registry.
Also validates that the artifact store is not local.
Returns:
Type | Description |
---|---|
Optional[StackValidator]
|
A StackValidator instance. |
compute_metadata(job: aiplatform.PipelineJob) -> Iterator[Dict[str, MetadataType]]
Generate run metadata based on the corresponding Vertex PipelineJob.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job
|
PipelineJob
|
The corresponding PipelineJob object. |
required |
Yields:
Type | Description |
---|---|
Dict[str, MetadataType]
|
A dictionary of metadata related to the pipeline run. |
Source code in src/zenml/integrations/gcp/orchestrators/vertex_orchestrator.py
931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 |
|
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/gcp/orchestrators/vertex_orchestrator.py
858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 |
|
get_orchestrator_run_id() -> str
Returns the active orchestrator run id.
Raises:
Type | Description |
---|---|
RuntimeError
|
If the environment variable specifying the run id is not set. |
Returns:
Type | Description |
---|---|
str
|
The orchestrator run id. |
Source code in src/zenml/integrations/gcp/orchestrators/vertex_orchestrator.py
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 |
|
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/gcp/orchestrators/vertex_orchestrator.py
774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
|
prepare_or_run_pipeline(deployment: PipelineDeploymentResponse, stack: Stack, environment: Dict[str, str], placeholder_run: Optional[PipelineRunResponse] = None) -> Iterator[Dict[str, MetadataType]]
Creates a KFP JSON pipeline.
noqa: DAR402
This is an intermediary representation of the pipeline which is then deployed to Vertex AI Pipelines service.
How it works:
Before this method is called the prepare_pipeline_deployment()
method
builds a Docker image that contains the code for the pipeline, all steps
the context around these files.
Based on this Docker image a callable is created which builds
container_ops for each step (_construct_kfp_pipeline
). The function
kfp.components.load_component_from_text
is used to create the
ContainerOp
, because using the dsl.ContainerOp
class directly is
deprecated when using the Kubeflow SDK v2. The step entrypoint command
with the entrypoint arguments is the command that will be executed by
the container created using the previously created Docker image.
This callable is then compiled into a JSON file that is used as the intermediary representation of the Kubeflow pipeline.
This file then is submitted to the Vertex AI Pipelines service for execution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
PipelineDeploymentResponse
|
The pipeline deployment to prepare or run. |
required |
stack
|
Stack
|
The stack the pipeline will 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 |
---|---|
ValueError
|
If the attribute |
Yields:
Type | Description |
---|---|
Dict[str, MetadataType]
|
A dictionary of metadata related to the pipeline run. |
Source code in src/zenml/integrations/gcp/orchestrators/vertex_orchestrator.py
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 |
|
prepare_pipeline_deployment(deployment: PipelineDeploymentResponse, stack: Stack) -> None
Build a Docker image and push it to the container registry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
PipelineDeploymentResponse
|
The pipeline deployment configuration. |
required |
stack
|
Stack
|
The stack on which the pipeline will be deployed. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If |
Source code in src/zenml/integrations/gcp/orchestrators/vertex_orchestrator.py
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 |
|
Modules
vertex_orchestrator
Implementation of the VertexAI orchestrator.
VertexOrchestrator(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
, GoogleCredentialsMixin
Orchestrator responsible for running pipelines on Vertex AI.
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: VertexOrchestratorConfig
property
Returns the VertexOrchestratorConfig
config.
Returns:
Type | Description |
---|---|
VertexOrchestratorConfig
|
The configuration. |
pipeline_directory: str
property
Returns path to directory where kubeflow pipelines files are stored.
Returns:
Type | Description |
---|---|
str
|
Path to the pipeline directory. |
root_directory: str
property
Returns path to the root directory for files for this orchestrator.
Returns:
Type | Description |
---|---|
str
|
The path to the root directory for all files concerning this |
str
|
orchestrator. |
settings_class: Optional[Type[BaseSettings]]
property
Settings class for the Vertex orchestrator.
Returns:
Type | Description |
---|---|
Optional[Type[BaseSettings]]
|
The settings class. |
validator: Optional[StackValidator]
property
Validates that the stack contains a container registry.
Also validates that the artifact store is not local.
Returns:
Type | Description |
---|---|
Optional[StackValidator]
|
A StackValidator instance. |
compute_metadata(job: aiplatform.PipelineJob) -> Iterator[Dict[str, MetadataType]]
Generate run metadata based on the corresponding Vertex PipelineJob.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job
|
PipelineJob
|
The corresponding PipelineJob object. |
required |
Yields:
Type | Description |
---|---|
Dict[str, MetadataType]
|
A dictionary of metadata related to the pipeline run. |
Source code in src/zenml/integrations/gcp/orchestrators/vertex_orchestrator.py
931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 |
|
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/gcp/orchestrators/vertex_orchestrator.py
858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 |
|
get_orchestrator_run_id() -> str
Returns the active orchestrator run id.
Raises:
Type | Description |
---|---|
RuntimeError
|
If the environment variable specifying the run id is not set. |
Returns:
Type | Description |
---|---|
str
|
The orchestrator run id. |
Source code in src/zenml/integrations/gcp/orchestrators/vertex_orchestrator.py
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 |
|
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/gcp/orchestrators/vertex_orchestrator.py
774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
|
prepare_or_run_pipeline(deployment: PipelineDeploymentResponse, stack: Stack, environment: Dict[str, str], placeholder_run: Optional[PipelineRunResponse] = None) -> Iterator[Dict[str, MetadataType]]
Creates a KFP JSON pipeline.
noqa: DAR402
This is an intermediary representation of the pipeline which is then deployed to Vertex AI Pipelines service.
How it works:
Before this method is called the prepare_pipeline_deployment()
method
builds a Docker image that contains the code for the pipeline, all steps
the context around these files.
Based on this Docker image a callable is created which builds
container_ops for each step (_construct_kfp_pipeline
). The function
kfp.components.load_component_from_text
is used to create the
ContainerOp
, because using the dsl.ContainerOp
class directly is
deprecated when using the Kubeflow SDK v2. The step entrypoint command
with the entrypoint arguments is the command that will be executed by
the container created using the previously created Docker image.
This callable is then compiled into a JSON file that is used as the intermediary representation of the Kubeflow pipeline.
This file then is submitted to the Vertex AI Pipelines service for execution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
PipelineDeploymentResponse
|
The pipeline deployment to prepare or run. |
required |
stack
|
Stack
|
The stack the pipeline will 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 |
---|---|
ValueError
|
If the attribute |
Yields:
Type | Description |
---|---|
Dict[str, MetadataType]
|
A dictionary of metadata related to the pipeline run. |
Source code in src/zenml/integrations/gcp/orchestrators/vertex_orchestrator.py
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 |
|
prepare_pipeline_deployment(deployment: PipelineDeploymentResponse, stack: Stack) -> None
Build a Docker image and push it to the container registry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deployment
|
PipelineDeploymentResponse
|
The pipeline deployment configuration. |
required |
stack
|
Stack
|
The stack on which the pipeline will be deployed. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If |
Source code in src/zenml/integrations/gcp/orchestrators/vertex_orchestrator.py
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 |
|
service_connectors
ZenML GCP Service Connector.
Classes
GCPServiceConnector(**kwargs: Any)
Bases: ServiceConnector
GCP 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 |
|
get_session(auth_method: str, resource_type: Optional[str] = None, resource_id: Optional[str] = None) -> Tuple[gcp_credentials.Credentials, Optional[datetime.datetime]]
Get a GCP session object with credentials 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 credentials for. |
None
|
resource_id
|
Optional[str]
|
The resource ID to get credentials for. |
None
|
Returns:
Type | Description |
---|---|
Credentials
|
GCP session with credentials for the specified resource and its |
Optional[datetime]
|
expiration timestamp, if applicable. |
Source code in src/zenml/integrations/gcp/service_connectors/gcp_service_connector.py
1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 |
|
Modules
gcp_service_connector
GCP Service Connector.
The GCP Service Connector implements various authentication methods for GCP services:
- Explicit GCP service account key
GCPAuthenticationMethods
GCPBaseConfig
Bases: AuthenticationConfig
GCP base configuration.
gcp_project_id: str
property
Get the GCP project ID.
This method must be implemented by subclasses to ensure that the GCP project ID is always available.
Raises:
Type | Description |
---|---|
NotImplementedError
|
If the method is not implemented. |
GCPBaseProjectIDConfig
Bases: GCPBaseConfig
GCP base configuration with included project ID.
gcp_project_id: str
property
Get the GCP project ID.
Returns:
Type | Description |
---|---|
str
|
The GCP project ID. |
GCPExternalAccountConfig
GCPExternalAccountCredentials
Bases: AuthenticationConfig
GCP external account credentials.
validate_external_account_json(value: PlainSerializedSecretStr) -> PlainSerializedSecretStr
classmethod
Validate the external account credentials JSON.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
PlainSerializedSecretStr
|
The external account credentials JSON. |
required |
Returns:
Type | Description |
---|---|
PlainSerializedSecretStr
|
The validated external account credentials JSON. |
Raises:
Type | Description |
---|---|
ValueError
|
If the external account credentials JSON is invalid. |
Source code in src/zenml/integrations/gcp/service_connectors/gcp_service_connector.py
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 |
|
validate_service_account_dict(data: Dict[str, Any]) -> Dict[str, Any]
classmethod
Convert the external account credentials to JSON if given in dict format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Dict[str, Any]
|
The configuration values. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The validated configuration values. |
Raises:
Type | Description |
---|---|
ValueError
|
If the external account credentials JSON is invalid. |
Source code in src/zenml/integrations/gcp/service_connectors/gcp_service_connector.py
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 |
|
GCPOAuth2Token
GCPOAuth2TokenConfig
GCPServiceAccountConfig
Bases: GCPBaseConfig
, GCPServiceAccountCredentials
GCP service account configuration.
gcp_project_id: str
property
Get the GCP project ID.
When a service account JSON is provided, the project ID can be extracted from it instead of being provided explicitly.
Returns:
Type | Description |
---|---|
str
|
The GCP project ID. |
GCPServiceAccountCredentials
Bases: AuthenticationConfig
GCP service account credentials.
validate_service_account_dict(data: Dict[str, Any]) -> Dict[str, Any]
classmethod
Convert the service account credentials to JSON if given in dict format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Dict[str, Any]
|
The configuration values. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The validated configuration values. |
Raises:
Type | Description |
---|---|
ValueError
|
If the service account credentials JSON is invalid. |
Source code in src/zenml/integrations/gcp/service_connectors/gcp_service_connector.py
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 |
|
validate_service_account_json(value: PlainSerializedSecretStr) -> PlainSerializedSecretStr
classmethod
Validate the service account credentials JSON.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
PlainSerializedSecretStr
|
The service account credentials JSON. |
required |
Returns:
Type | Description |
---|---|
PlainSerializedSecretStr
|
The validated service account credentials JSON. |
Raises:
Type | Description |
---|---|
ValueError
|
If the service account credentials JSON is invalid. |
Source code in src/zenml/integrations/gcp/service_connectors/gcp_service_connector.py
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 |
|
GCPServiceAccountImpersonationConfig
GCPServiceConnector(**kwargs: Any)
Bases: ServiceConnector
GCP 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 |
|
get_session(auth_method: str, resource_type: Optional[str] = None, resource_id: Optional[str] = None) -> Tuple[gcp_credentials.Credentials, Optional[datetime.datetime]]
Get a GCP session object with credentials 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 credentials for. |
None
|
resource_id
|
Optional[str]
|
The resource ID to get credentials for. |
None
|
Returns:
Type | Description |
---|---|
Credentials
|
GCP session with credentials for the specified resource and its |
Optional[datetime]
|
expiration timestamp, if applicable. |
Source code in src/zenml/integrations/gcp/service_connectors/gcp_service_connector.py
1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 |
|
GCPUserAccountConfig
GCPUserAccountCredentials
Bases: AuthenticationConfig
GCP user account credentials.
validate_user_account_dict(data: Dict[str, Any]) -> Dict[str, Any]
classmethod
Convert the user account credentials to JSON if given in dict format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Dict[str, Any]
|
The configuration values. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The validated configuration values. |
Raises:
Type | Description |
---|---|
ValueError
|
If the user account credentials JSON is invalid. |
Source code in src/zenml/integrations/gcp/service_connectors/gcp_service_connector.py
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 |
|
validate_user_account_json(value: PlainSerializedSecretStr) -> PlainSerializedSecretStr
classmethod
Validate the user account credentials JSON.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
PlainSerializedSecretStr
|
The user account credentials JSON. |
required |
Returns:
Type | Description |
---|---|
PlainSerializedSecretStr
|
The validated user account credentials JSON. |
Raises:
Type | Description |
---|---|
ValueError
|
If the user account credentials JSON is invalid. |
Source code in src/zenml/integrations/gcp/service_connectors/gcp_service_connector.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 174 175 176 177 178 179 180 181 182 183 |
|
ZenMLAwsSecurityCredentialsSupplier
Bases: _DefaultAwsSecurityCredentialsSupplier
An improved version of the GCP external account credential supplier for AWS.
The original GCP external account credential supplier only provides rudimentary support for extracting AWS credentials from environment variables or the AWS metadata service. This version improves on that by using the boto3 library itself (if available), which uses the entire range of implicit authentication features packed into it.
Without this improvement, sts.AssumeRoleWithWebIdentity
authentication is
not supported for EKS pods and the EC2 attached role credentials are
used instead (see: https://medium.com/@derek10cloud/gcp-workload-identity-federation-doesnt-yet-support-eks-irsa-in-aws-a3c71877671a).
get_aws_region(context: Any, request: Any) -> str
Get the AWS region from the local environment.
This method is a copy of the original method from the
google.auth.aws._DefaultAwsSecurityCredentialsSupplier
class. It has
been modified to use the boto3 library to extract the AWS
region from the local environment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context
|
Any
|
The context to use to get the security credentials. |
required |
request
|
Any
|
The request to use to get the security credentials. |
required |
Returns:
Type | Description |
---|---|
str
|
The AWS region. |
Source code in src/zenml/integrations/gcp/service_connectors/gcp_service_connector.py
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 |
|
get_aws_security_credentials(context: Any, request: Any) -> gcp_aws.AwsSecurityCredentials
Get the security credentials from the local environment.
This method is a copy of the original method from the
google.auth.aws._DefaultAwsSecurityCredentialsSupplier
class. It has
been modified to use the boto3 library to extract the AWS credentials
from the local environment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context
|
Any
|
The context to use to get the security credentials. |
required |
request
|
Any
|
The request to use to get the security credentials. |
required |
Returns:
Type | Description |
---|---|
AwsSecurityCredentials
|
The AWS temporary security credentials. |
Source code in src/zenml/integrations/gcp/service_connectors/gcp_service_connector.py
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 |
|
ZenMLGCPAWSExternalAccountCredentials
Bases: Credentials
An improved version of the GCP external account credential for AWS.
The original GCP external account credential only provides rudimentary support for extracting AWS credentials from environment variables or the AWS metadata service. This version improves on that by using the boto3 library itself (if available), which uses the entire range of implicit authentication features packed into it.
Without this improvement, sts.AssumeRoleWithWebIdentity
authentication is
not supported for EKS pods and the EC2 attached role credentials are
used instead (see: https://medium.com/@derek10cloud/gcp-workload-identity-federation-doesnt-yet-support-eks-irsa-in-aws-a3c71877671a).
IMPORTANT: subclassing this class only works with the google-auth
library
version lower than 2.29.0. Starting from version 2.29.0, the AWS logic
has been moved to a separate google.auth.aws._DefaultAwsSecurityCredentialsSupplier
class that can be subclassed instead and supplied as the
aws_security_credentials_supplier
parameter to the
google.auth.aws.Credentials
class.
step_operators
Initialization for the VertexAI Step Operator.
Classes
VertexStepOperator(*args: Any, **kwargs: Any)
Bases: BaseStepOperator
, GoogleCredentialsMixin
Step operator to run a step on Vertex AI.
This class defines code that can set up a Vertex AI environment and run the ZenML entrypoint command in it.
Initializes the step operator and validates the accelerator type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Any
|
Variable length argument list. |
()
|
**kwargs
|
Any
|
Arbitrary keyword arguments. |
{}
|
Source code in src/zenml/integrations/gcp/step_operators/vertex_step_operator.py
81 82 83 84 85 86 87 88 |
|
config: VertexStepOperatorConfig
property
Returns the VertexStepOperatorConfig
config.
Returns:
Type | Description |
---|---|
VertexStepOperatorConfig
|
The configuration. |
settings_class: Optional[Type[BaseSettings]]
property
Settings class for the Vertex 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/gcp/step_operators/vertex_step_operator.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
launch(info: StepRunInfo, entrypoint_command: List[str], environment: Dict[str, str]) -> None
Launches a step on VertexAI.
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 run fails. |
Source code in src/zenml/integrations/gcp/step_operators/vertex_step_operator.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
|
Modules
vertex_step_operator
Implementation of a VertexAI step operator.
Code heavily inspired by TFX Implementation: https://github.com/tensorflow/tfx/blob/master/tfx/extensions/ google_cloud_ai_platform/training_clients.py
VertexStepOperator(*args: Any, **kwargs: Any)
Bases: BaseStepOperator
, GoogleCredentialsMixin
Step operator to run a step on Vertex AI.
This class defines code that can set up a Vertex AI environment and run the ZenML entrypoint command in it.
Initializes the step operator and validates the accelerator type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Any
|
Variable length argument list. |
()
|
**kwargs
|
Any
|
Arbitrary keyword arguments. |
{}
|
Source code in src/zenml/integrations/gcp/step_operators/vertex_step_operator.py
81 82 83 84 85 86 87 88 |
|
config: VertexStepOperatorConfig
property
Returns the VertexStepOperatorConfig
config.
Returns:
Type | Description |
---|---|
VertexStepOperatorConfig
|
The configuration. |
settings_class: Optional[Type[BaseSettings]]
property
Settings class for the Vertex 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/gcp/step_operators/vertex_step_operator.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
launch(info: StepRunInfo, entrypoint_command: List[str], environment: Dict[str, str]) -> None
Launches a step on VertexAI.
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 run fails. |
Source code in src/zenml/integrations/gcp/step_operators/vertex_step_operator.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
|
validate_accelerator_type(accelerator_type: Optional[str] = None) -> None
Validates that the accelerator type is valid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
accelerator_type
|
Optional[str]
|
The accelerator type to validate. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
If the accelerator type is not valid. |
Source code in src/zenml/integrations/gcp/step_operators/vertex_step_operator.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
vertex_custom_job_parameters
Vertex custom job parameter model.
Classes
VertexCustomJobParameters
Bases: BaseModel
Settings for the Vertex custom job parameters.
Attributes:
Name | Type | Description |
---|---|---|
accelerator_type |
Optional[str]
|
Defines which accelerator (GPU, TPU) is used for the job. Check out out this table to see which accelerator type and count are compatible with your chosen machine type: https://cloud.google.com/vertex-ai/docs/training/configure-compute#gpu-compatibility-table. |
accelerator_count |
int
|
Defines number of accelerators to be used for the job. Check out out this table to see which accelerator type and count are compatible with your chosen machine type: https://cloud.google.com/vertex-ai/docs/training/configure-compute#gpu-compatibility-table. |
machine_type |
str
|
Machine type specified here https://cloud.google.com/vertex-ai/docs/training/configure-compute#machine-types. |
boot_disk_size_gb |
int
|
Size of the boot disk in GB. (Default: 100) https://cloud.google.com/vertex-ai/docs/training/configure-compute#boot_disk_options |
boot_disk_type |
str
|
Type of the boot disk. (Default: pd-ssd) https://cloud.google.com/vertex-ai/docs/training/configure-compute#boot_disk_options |
persistent_resource_id |
Optional[str]
|
The ID of the persistent resource to use for the job. https://cloud.google.com/vertex-ai/docs/training/persistent-resource-overview |
service_account |
Optional[str]
|
Specifies the service account to be used. |