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 (extracted using
pip freeze
)
- 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 defined inside a pyproject.toml file given by the
pyproject_path
attribute.
- The packages specified via the requirements
attribute
If neither replicate_local_python_environment
, pyproject_path
or
requirements
are specified, ZenML will try to automatically find a
requirements.txt or pyproject.toml file in your current source root
and installs packages from the first one it finds. You can disable this
behavior by setting disable_automatic_requirements_detection=True
.
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. |
disable_automatic_requirements_detection |
bool
|
If set to True, ZenML will not automatically detect requirements.txt files or pyproject.toml files in your source root. |
replicate_local_python_environment |
Optional[Union[List[str], PythonEnvironmentExportMethod, bool]]
|
If set to True, ZenML will run
|
pyproject_path |
Optional[str]
|
Path to a pyproject.toml file. If given, the
dependencies will be exported to a requirements.txt
formatted file using the |
pyproject_export_command |
Optional[List[str]]
|
Command to export the dependencies inside a
pyproject.toml file to a requirements.txt formatted file. If not
given and ZenML needs to export the requirements anyway, |
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. |
install_stack_requirements |
bool
|
If |
local_project_install_command |
Optional[str]
|
Command to install a local project in the Docker image. This is run after the code files are copied into the image, and it is therefore only possible when code is included in the image, not downloaded at runtime. |
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 |
Source code in src/zenml/config/docker_settings.py
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 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
|
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 |
|