Config
The config
module contains classes and functions that manage user-specific configuration.
ZenML's configuration is stored in a file called
config.yaml
, located on the user's directory for configuration files.
(The exact location differs from operating system to operating system.)
The GlobalConfiguration
class is the main class in this module. It provides
a Pydantic configuration object that is used to store and retrieve
configuration. This GlobalConfiguration
object handles the serialization and
deserialization of the configuration options that are stored in the file in
order to persist the configuration across sessions.
DockerSettings
Bases: BaseSettings
Settings for building Docker images to run ZenML pipelines.
Build process:
- No
dockerfile
specified: If any of the options regarding requirements, environment variables or copying files require us to build an image, ZenML will build this image. Otherwise, theparent_image
will be used to run the pipeline. dockerfile
specified: ZenML will first build an image based on the specified Dockerfile. If any of the options regarding requirements, environment variables or copying files require an additional image built on top of that, ZenML will build a second image. If not, the image build from the specified Dockerfile will be used to run the pipeline.
Requirements installation order:
Depending on the configuration of this object, requirements will be
installed in the following order (each step optional):
- The packages installed in your local python environment
- The packages required by the stack unless this is disabled by setting
install_stack_requirements=False
.
- The packages specified via the required_integrations
- The packages specified via the requirements
attribute
Attributes:
Name | Type | Description |
---|---|---|
parent_image |
Optional[str]
|
Full name of the Docker image that should be used as the parent for the image that will be built. Defaults to a ZenML image built for the active Python and ZenML version. Additional notes:
* If you specify a custom image here, you need to make sure it has
ZenML installed.
* If this is a non-local image, the environment which is running
the pipeline and building the Docker image needs to be able to pull
this image.
* If a custom |
dockerfile |
Optional[str]
|
Path to a custom Dockerfile that should be built. Depending on the other values you specify in this object, the resulting image will be used directly to run your pipeline or ZenML will use it as a parent image to build on top of. See the general docstring of this class for more information. Additional notes:
* If you specify this, the |
build_context_root |
Optional[str]
|
Build context root for the Docker build, only used
when the |
parent_image_build_config |
Optional[DockerBuildConfig]
|
Configuration for the parent image build. |
skip_build |
bool
|
If set to |
prevent_build_reuse |
bool
|
Prevent the reuse of an existing build. |
target_repository |
Optional[str]
|
Name of the Docker repository to which the image should be pushed. This repository will be appended to the registry URI of the container registry of your stack and should therefore not include any registry. If not specified, the default repository name configured in the container registry stack component settings will be used. |
python_package_installer |
PythonPackageInstaller
|
The package installer to use for python packages. |
python_package_installer_args |
Dict[str, Any]
|
Arguments to pass to the python package installer. |
replicate_local_python_environment |
Optional[Union[List[str], PythonEnvironmentExportMethod]]
|
If not |
requirements |
Union[None, str, List[str]]
|
Path to a requirements file or a list of required pip
packages. During the image build, these requirements will be
installed using pip. If you need to use a different tool to
resolve and/or install your packages, please use a custom parent
image or specify a custom |
required_integrations |
List[str]
|
List of ZenML integrations that should be installed. All requirements for the specified integrations will be installed inside the Docker image. |
required_hub_plugins |
List[str]
|
DEPRECATED/UNUSED. |
install_stack_requirements |
bool
|
If |
apt_packages |
List[str]
|
APT packages to install inside the Docker image. |
environment |
Dict[str, Any]
|
Dictionary of environment variables to set inside the Docker image. |
build_config |
Optional[DockerBuildConfig]
|
Configuration for the main image build. |
user |
Optional[str]
|
If not |
allow_including_files_in_images |
bool
|
If |
allow_download_from_code_repository |
bool
|
If |
allow_download_from_artifact_store |
bool
|
If |
build_options |
Dict[str, Any]
|
DEPRECATED, use parent_image_build_config.build_options instead. |
dockerignore |
Optional[str]
|
DEPRECATED, use build_config.dockerignore instead. |
copy_files |
bool
|
DEPRECATED/UNUSED. |
copy_global_config |
bool
|
DEPRECATED/UNUSED. |
source_files |
Optional[str]
|
DEPRECATED. Use allow_including_files_in_images, allow_download_from_code_repository and allow_download_from_artifact_store instead. |
Source code in src/zenml/config/docker_settings.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 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 |
|
ResourceSettings
Bases: BaseSettings
Hardware resource settings.
Attributes:
Name | Type | Description |
---|---|---|
cpu_count |
Optional[PositiveFloat]
|
The amount of CPU cores that should be configured. |
gpu_count |
Optional[NonNegativeInt]
|
The amount of GPUs that should be configured. |
memory |
Optional[str]
|
The amount of memory that should be configured. |
Source code in src/zenml/config/resource_settings.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
empty
property
Returns if this object is "empty" (=no values configured) or not.
Returns:
Type | Description |
---|---|
bool
|
|
get_memory(unit=ByteUnit.GB)
Gets the memory configuration in a specific unit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
unit
|
Union[str, ByteUnit]
|
The unit to which the memory should be converted. |
GB
|
Raises:
Type | Description |
---|---|
ValueError
|
If the memory string is invalid. |
Returns:
Type | Description |
---|---|
Optional[float]
|
The memory configuration converted to the requested unit, or None |
Optional[float]
|
if no memory was configured. |
Source code in src/zenml/config/resource_settings.py
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 |
|
StepRetryConfig
Bases: StrictBaseModel
Retry configuration for a step.
Delay is an integer (specified in seconds).
Source code in src/zenml/config/retry_config.py
19 20 21 22 23 24 25 26 27 |
|