0
# Enums
1
2
Important enumerations used throughout the ZenML API. Enums provide type-safe constants for statuses, component types, stages, and configuration options.
3
4
## Capabilities
5
6
### Execution Status
7
8
```python { .api }
9
class ExecutionStatus(str, Enum):
10
"""
11
Pipeline and step execution status.
12
13
Values:
14
- INITIALIZING: Execution is initializing
15
- PROVISIONING: Resources being provisioned
16
- RUNNING: Currently executing
17
- COMPLETED: Successfully completed
18
- FAILED: Execution failed
19
- CACHED: Result retrieved from cache
20
- RETRYING: Being retried after failure
21
- RETRIED: Was retried
22
- STOPPED: Stopped by user
23
- STOPPING: In process of stopping
24
"""
25
INITIALIZING = "initializing"
26
PROVISIONING = "provisioning"
27
RUNNING = "running"
28
COMPLETED = "completed"
29
FAILED = "failed"
30
CACHED = "cached"
31
RETRYING = "retrying"
32
RETRIED = "retried"
33
STOPPED = "stopped"
34
STOPPING = "stopping"
35
```
36
37
Import from:
38
39
```python
40
from zenml.enums import ExecutionStatus
41
```
42
43
### Stack Component Type
44
45
```python { .api }
46
class StackComponentType(str, Enum):
47
"""
48
Stack component types.
49
50
Values:
51
- ORCHESTRATOR: Pipeline orchestration (required)
52
- ARTIFACT_STORE: Artifact storage (required)
53
- CONTAINER_REGISTRY: Container image registry
54
- IMAGE_BUILDER: Container image builder
55
- STEP_OPERATOR: Remote step execution
56
- EXPERIMENT_TRACKER: Experiment tracking
57
- MODEL_DEPLOYER: Model deployment
58
- FEATURE_STORE: Feature store
59
- MODEL_REGISTRY: Model registry
60
- DATA_VALIDATOR: Data validation
61
- ALERTER: Alerting/notifications
62
- ANNOTATOR: Data annotation
63
- DEPLOYER: Pipeline deployment
64
"""
65
ORCHESTRATOR = "orchestrator"
66
ARTIFACT_STORE = "artifact_store"
67
CONTAINER_REGISTRY = "container_registry"
68
IMAGE_BUILDER = "image_builder"
69
STEP_OPERATOR = "step_operator"
70
EXPERIMENT_TRACKER = "experiment_tracker"
71
MODEL_DEPLOYER = "model_deployer"
72
FEATURE_STORE = "feature_store"
73
MODEL_REGISTRY = "model_registry"
74
DATA_VALIDATOR = "data_validator"
75
ALERTER = "alerter"
76
ANNOTATOR = "annotator"
77
DEPLOYER = "deployer"
78
```
79
80
Import from:
81
82
```python
83
from zenml.enums import StackComponentType
84
```
85
86
### Model Stages
87
88
```python { .api }
89
class ModelStages(str, Enum):
90
"""
91
Model lifecycle stages.
92
93
Values:
94
- NONE: No specific stage
95
- STAGING: Model in staging environment
96
- PRODUCTION: Model in production
97
- ARCHIVED: Archived model
98
- LATEST: Latest model version (special marker)
99
"""
100
NONE = "none"
101
STAGING = "staging"
102
PRODUCTION = "production"
103
ARCHIVED = "archived"
104
LATEST = "latest"
105
```
106
107
Import from:
108
109
```python
110
from zenml.enums import ModelStages
111
```
112
113
### Artifact Type
114
115
```python { .api }
116
class ArtifactType(str, Enum):
117
"""
118
Types of artifacts.
119
120
Values:
121
- DATA: General data artifacts
122
- MODEL: Model artifacts
123
- DATA_ANALYSIS: Data analysis results
124
- SERVICE: Service artifacts
125
- STATISTICS: Statistical data
126
- SCHEMA: Schema definitions
127
- BASE: Base artifact type
128
"""
129
DATA = "data"
130
MODEL = "model"
131
DATA_ANALYSIS = "data_analysis"
132
SERVICE = "service"
133
STATISTICS = "statistics"
134
SCHEMA = "schema"
135
BASE = "base"
136
```
137
138
Import from:
139
140
```python
141
from zenml.enums import ArtifactType
142
```
143
144
### Visualization Type
145
146
```python { .api }
147
class VisualizationType(str, Enum):
148
"""
149
Types of artifact visualizations.
150
151
Values:
152
- CSV: CSV data visualization
153
- HTML: HTML visualization
154
- IMAGE: Image visualization
155
- MARKDOWN: Markdown visualization
156
- JSON: JSON visualization
157
"""
158
CSV = "csv"
159
HTML = "html"
160
IMAGE = "image"
161
MARKDOWN = "markdown"
162
JSON = "json"
163
```
164
165
Import from:
166
167
```python
168
from zenml.enums import VisualizationType
169
```
170
171
### Execution Mode
172
173
```python { .api }
174
class ExecutionMode(str, Enum):
175
"""
176
Pipeline execution mode for error handling.
177
178
Values:
179
- FAIL_FAST: Stop on first step failure
180
- STOP_ON_FAILURE: Deprecated, same as FAIL_FAST
181
- CONTINUE_ON_FAILURE: Continue executing independent steps
182
"""
183
FAIL_FAST = "fail_fast"
184
STOP_ON_FAILURE = "stop_on_failure"
185
CONTINUE_ON_FAILURE = "continue_on_failure"
186
```
187
188
Import from:
189
190
```python
191
from zenml.enums import ExecutionMode
192
```
193
194
### Store Type
195
196
```python { .api }
197
class StoreType(str, Enum):
198
"""
199
ZenML store backend types.
200
201
Values:
202
- SQL: SQL database store
203
- REST: REST API store (ZenML server)
204
"""
205
SQL = "sql"
206
REST = "rest"
207
```
208
209
Import from:
210
211
```python
212
from zenml.enums import StoreType
213
```
214
215
### Secrets Store Type
216
217
```python { .api }
218
class SecretsStoreType(str, Enum):
219
"""
220
Secrets store backend types.
221
222
Values:
223
- NONE: No secrets store
224
- SQL: SQL database
225
- AWS: AWS Secrets Manager
226
- GCP: Google Secret Manager
227
- AZURE: Azure Key Vault
228
- HASHICORP: HashiCorp Vault
229
- CUSTOM: Custom secrets store
230
"""
231
NONE = "none"
232
SQL = "sql"
233
AWS = "aws"
234
GCP = "gcp"
235
AZURE = "azure"
236
HASHICORP = "hashicorp"
237
CUSTOM = "custom"
238
```
239
240
Import from:
241
242
```python
243
from zenml.enums import SecretsStoreType
244
```
245
246
### Logging Levels
247
248
```python { .api }
249
class LoggingLevels(str, Enum):
250
"""
251
Logging level options.
252
253
Values:
254
- NOTSET: Not set
255
- DEBUG: Debug messages
256
- INFO: Informational messages
257
- WARN: Warning messages
258
- WARNING: Warning messages (alias)
259
- ERROR: Error messages
260
- CRITICAL: Critical errors
261
"""
262
NOTSET = "NOTSET"
263
DEBUG = "DEBUG"
264
INFO = "INFO"
265
WARN = "WARN"
266
WARNING = "WARNING"
267
ERROR = "ERROR"
268
CRITICAL = "CRITICAL"
269
```
270
271
Import from:
272
273
```python
274
from zenml.enums import LoggingLevels
275
```
276
277
### Taggable Resource Types
278
279
```python { .api }
280
class TaggableResourceTypes(str, Enum):
281
"""
282
Resource types that can be tagged.
283
284
Values:
285
- ARTIFACT: Artifact resources
286
- ARTIFACT_VERSION: Artifact version resources
287
- MODEL: Model resources
288
- MODEL_VERSION: Model version resources
289
- PIPELINE: Pipeline resources
290
- PIPELINE_RUN: Pipeline run resources
291
- RUN_TEMPLATE: Run template resources
292
- PIPELINE_SNAPSHOT: Pipeline snapshot resources
293
- DEPLOYMENT: Deployment resources
294
"""
295
ARTIFACT = "artifact"
296
ARTIFACT_VERSION = "artifact_version"
297
MODEL = "model"
298
MODEL_VERSION = "model_version"
299
PIPELINE = "pipeline"
300
PIPELINE_RUN = "pipeline_run"
301
RUN_TEMPLATE = "run_template"
302
PIPELINE_SNAPSHOT = "pipeline_snapshot"
303
DEPLOYMENT = "deployment"
304
```
305
306
Import from:
307
308
```python
309
from zenml.enums import TaggableResourceTypes
310
```
311
312
### Metadata Resource Types
313
314
```python { .api }
315
class MetadataResourceTypes(str, Enum):
316
"""
317
Resource types that can have metadata.
318
319
Values:
320
- PIPELINE_RUN: Pipeline run metadata
321
- STEP_RUN: Step run metadata
322
- ARTIFACT_VERSION: Artifact version metadata
323
- MODEL_VERSION: Model version metadata
324
- SCHEDULE: Schedule metadata
325
"""
326
PIPELINE_RUN = "pipeline_run"
327
STEP_RUN = "step_run"
328
ARTIFACT_VERSION = "artifact_version"
329
MODEL_VERSION = "model_version"
330
SCHEDULE = "schedule"
331
```
332
333
Import from:
334
335
```python
336
from zenml.enums import MetadataResourceTypes
337
```
338
339
### Container Registry Flavor
340
341
```python { .api }
342
class ContainerRegistryFlavor(str, Enum):
343
"""
344
Container registry flavors.
345
346
Values:
347
- DEFAULT: Generic/default container registry
348
- GITHUB: GitHub Container Registry
349
- DOCKERHUB: Docker Hub
350
- GCP: Google Container Registry
351
- AZURE: Azure Container Registry
352
"""
353
DEFAULT = "default"
354
GITHUB = "github"
355
DOCKERHUB = "dockerhub"
356
GCP = "gcp"
357
AZURE = "azure"
358
```
359
360
Import from:
361
362
```python
363
from zenml.enums import ContainerRegistryFlavor
364
```
365
366
### Color Variants
367
368
```python { .api }
369
class ColorVariants(str, Enum):
370
"""
371
Color options for tags and UI elements.
372
373
Values:
374
- GREY, PURPLE, RED, GREEN, YELLOW, ORANGE, LIME,
375
TEAL, TURQUOISE, MAGENTA, BLUE
376
"""
377
GREY = "grey"
378
PURPLE = "purple"
379
RED = "red"
380
GREEN = "green"
381
YELLOW = "yellow"
382
ORANGE = "orange"
383
LIME = "lime"
384
TEAL = "teal"
385
TURQUOISE = "turquoise"
386
MAGENTA = "magenta"
387
BLUE = "blue"
388
```
389
390
Import from:
391
392
```python
393
from zenml.enums import ColorVariants
394
```
395
396
### Service State
397
398
```python { .api }
399
class ServiceState(str, Enum):
400
"""
401
Service states.
402
403
Values:
404
- INACTIVE: Service not running
405
- ACTIVE: Service running
406
- PENDING_STARTUP: Starting up
407
- PENDING_SHUTDOWN: Shutting down
408
- ERROR: Error state
409
- SCALED_TO_ZERO: Scaled to zero (serverless)
410
"""
411
INACTIVE = "inactive"
412
ACTIVE = "active"
413
PENDING_STARTUP = "pending_startup"
414
PENDING_SHUTDOWN = "pending_shutdown"
415
ERROR = "error"
416
SCALED_TO_ZERO = "scaled_to_zero"
417
```
418
419
Import from:
420
421
```python
422
from zenml.enums import ServiceState
423
```
424
425
### Environment Type
426
427
```python { .api }
428
class EnvironmentType(str, Enum):
429
"""
430
Execution environment types.
431
432
Values include:
433
- NATIVE: Native Python environment
434
- CONTAINER: Docker container
435
- KUBERNETES: Kubernetes pod
436
- NOTEBOOK: Jupyter notebook
437
- COLAB: Google Colab
438
- GITHUB_ACTION: GitHub Actions
439
- GITLAB_CI: GitLab CI
440
- And many more CI/CD and cloud environments
441
"""
442
NATIVE = "native"
443
CONTAINER = "container"
444
KUBERNETES = "kubernetes"
445
NOTEBOOK = "notebook"
446
COLAB = "colab"
447
GITHUB_ACTION = "github_action"
448
GITLAB_CI = "gitlab_ci"
449
# ... and more
450
```
451
452
Import from:
453
454
```python
455
from zenml.enums import EnvironmentType
456
```
457
458
## Usage Examples
459
460
### Checking Execution Status
461
462
```python
463
from zenml.client import Client
464
from zenml.enums import ExecutionStatus
465
466
client = Client()
467
run = client.get_pipeline_run("run_id")
468
469
if run.status == ExecutionStatus.COMPLETED:
470
print("Pipeline completed successfully")
471
elif run.status == ExecutionStatus.FAILED:
472
print("Pipeline failed")
473
elif run.status == ExecutionStatus.RUNNING:
474
print("Pipeline still running")
475
```
476
477
### Filtering by Component Type
478
479
```python
480
from zenml.client import Client
481
from zenml.enums import StackComponentType
482
483
client = Client()
484
485
# List all orchestrators
486
orchestrators = client.list_stack_components(
487
type=StackComponentType.ORCHESTRATOR
488
)
489
490
# List all artifact stores
491
stores = client.list_stack_components(
492
type=StackComponentType.ARTIFACT_STORE
493
)
494
```
495
496
### Using Model Stages
497
498
```python
499
from zenml import Model
500
from zenml.enums import ModelStages
501
from zenml.client import Client
502
503
# Reference production model
504
production_model = Model(
505
name="my_model",
506
version=ModelStages.PRODUCTION
507
)
508
509
# Update model stage
510
client = Client()
511
client.update_model_version(
512
model_name_or_id="my_model",
513
version_name_or_id="1.0.0",
514
stage=ModelStages.PRODUCTION
515
)
516
```
517
518
### Artifact Type Specification
519
520
```python
521
from zenml import save_artifact
522
from zenml.enums import ArtifactType
523
524
# Save with explicit type
525
model_artifact = save_artifact(
526
data={"weights": [0.1, 0.2]},
527
name="my_model",
528
artifact_type=ArtifactType.MODEL
529
)
530
531
data_artifact = save_artifact(
532
data=[1, 2, 3, 4, 5],
533
name="training_data",
534
artifact_type=ArtifactType.DATA
535
)
536
```
537
538
### Tag Colors
539
540
```python
541
from zenml.client import Client
542
from zenml.enums import ColorVariants
543
544
client = Client()
545
546
# Create colored tags
547
client.create_tag(name="production", color=ColorVariants.GREEN)
548
client.create_tag(name="experimental", color=ColorVariants.YELLOW)
549
client.create_tag(name="deprecated", color=ColorVariants.RED)
550
```
551
552
### Tagging Resources
553
554
```python
555
from zenml import add_tags
556
from zenml.enums import TaggableResourceTypes
557
from zenml.client import Client
558
559
client = Client()
560
561
# Get resource ID
562
artifact = client.get_artifact("my_artifact")
563
564
# Add tags
565
add_tags(
566
resource_id=artifact.id,
567
resource_type=TaggableResourceTypes.ARTIFACT,
568
tags=["production", "validated"]
569
)
570
```
571
572
### Logging Levels
573
574
```python
575
from zenml.enums import LoggingLevels
576
import os
577
578
# Set logging level via environment
579
os.environ["ZENML_LOGGING_VERBOSITY"] = LoggingLevels.DEBUG
580
```
581
582
### Execution Mode
583
584
```python
585
from zenml import pipeline
586
from zenml.enums import ExecutionMode
587
588
@pipeline(execution_mode=ExecutionMode.CONTINUE_ON_FAILURE)
589
def fault_tolerant_pipeline():
590
"""Pipeline continues even if some steps fail."""
591
pass
592
593
@pipeline(execution_mode=ExecutionMode.FAIL_FAST)
594
def strict_pipeline():
595
"""Pipeline stops on first failure."""
596
pass
597
```
598
599
### Store Type Checking
600
601
```python
602
from zenml.client import Client
603
from zenml.enums import StoreType
604
605
client = Client()
606
607
if client.zen_store.type == StoreType.REST:
608
print("Connected to ZenML server")
609
elif client.zen_store.type == StoreType.SQL:
610
print("Using local SQL store")
611
```
612