zenml-nightly 0.68.1.dev20241106__py3-none-any.whl → 0.68.1.dev20241108__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. zenml/VERSION +1 -1
  2. zenml/artifacts/external_artifact.py +2 -1
  3. zenml/artifacts/utils.py +133 -78
  4. zenml/cli/base.py +4 -4
  5. zenml/cli/model.py +1 -6
  6. zenml/cli/stack.py +1 -0
  7. zenml/client.py +21 -73
  8. zenml/constants.py +1 -0
  9. zenml/enums.py +12 -4
  10. zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py +1 -1
  11. zenml/integrations/azure/orchestrators/azureml_orchestrator.py +1 -1
  12. zenml/integrations/evidently/__init__.py +1 -1
  13. zenml/integrations/gcp/orchestrators/vertex_orchestrator.py +1 -1
  14. zenml/integrations/tensorboard/visualizers/tensorboard_visualizer.py +60 -54
  15. zenml/integrations/vllm/services/vllm_deployment.py +16 -7
  16. zenml/metadata/lazy_load.py +20 -7
  17. zenml/model/model.py +1 -2
  18. zenml/models/__init__.py +0 -12
  19. zenml/models/v2/core/artifact_version.py +19 -7
  20. zenml/models/v2/core/model_version.py +3 -5
  21. zenml/models/v2/core/pipeline_run.py +3 -5
  22. zenml/models/v2/core/run_metadata.py +2 -217
  23. zenml/models/v2/core/step_run.py +40 -24
  24. zenml/orchestrators/input_utils.py +44 -19
  25. zenml/orchestrators/step_launcher.py +2 -2
  26. zenml/orchestrators/step_run_utils.py +19 -15
  27. zenml/orchestrators/step_runner.py +21 -13
  28. zenml/steps/base_step.py +1 -1
  29. zenml/steps/entrypoint_function_utils.py +3 -5
  30. zenml/steps/step_context.py +3 -2
  31. zenml/steps/utils.py +8 -2
  32. zenml/zen_server/rbac/endpoint_utils.py +43 -1
  33. zenml/zen_server/rbac/utils.py +0 -2
  34. zenml/zen_server/routers/artifact_version_endpoints.py +27 -1
  35. zenml/zen_server/routers/workspaces_endpoints.py +3 -4
  36. zenml/zen_server/zen_server_api.py +0 -2
  37. zenml/zen_stores/migrations/versions/1cb6477f72d6_move_artifact_save_type.py +99 -0
  38. zenml/zen_stores/migrations/versions/b557b2871693_update_step_run_input_types.py +33 -0
  39. zenml/zen_stores/rest_zen_store.py +55 -54
  40. zenml/zen_stores/schemas/artifact_schemas.py +8 -1
  41. zenml/zen_stores/schemas/model_schemas.py +2 -2
  42. zenml/zen_stores/schemas/pipeline_run_schemas.py +1 -1
  43. zenml/zen_stores/schemas/run_metadata_schemas.py +1 -48
  44. zenml/zen_stores/schemas/step_run_schemas.py +18 -10
  45. zenml/zen_stores/sql_zen_store.py +68 -98
  46. zenml/zen_stores/zen_store_interface.py +15 -42
  47. {zenml_nightly-0.68.1.dev20241106.dist-info → zenml_nightly-0.68.1.dev20241108.dist-info}/METADATA +1 -1
  48. {zenml_nightly-0.68.1.dev20241106.dist-info → zenml_nightly-0.68.1.dev20241108.dist-info}/RECORD +51 -50
  49. zenml/zen_server/routers/run_metadata_endpoints.py +0 -96
  50. {zenml_nightly-0.68.1.dev20241106.dist-info → zenml_nightly-0.68.1.dev20241108.dist-info}/LICENSE +0 -0
  51. {zenml_nightly-0.68.1.dev20241106.dist-info → zenml_nightly-0.68.1.dev20241108.dist-info}/WHEEL +0 -0
  52. {zenml_nightly-0.68.1.dev20241106.dist-info → zenml_nightly-0.68.1.dev20241108.dist-info}/entry_points.txt +0 -0
zenml/VERSION CHANGED
@@ -1 +1 @@
1
- 0.68.1.dev20241106
1
+ 0.68.1.dev20241108
@@ -23,6 +23,7 @@ from zenml.artifacts.external_artifact_config import (
23
23
  ExternalArtifactConfiguration,
24
24
  )
25
25
  from zenml.config.source import Source
26
+ from zenml.enums import ArtifactSaveType
26
27
  from zenml.logger import get_logger
27
28
  from zenml.materializers.base_materializer import BaseMaterializer
28
29
 
@@ -114,7 +115,7 @@ class ExternalArtifact(ExternalArtifactConfiguration):
114
115
  materializer=self.materializer,
115
116
  uri=uri,
116
117
  has_custom_name=False,
117
- manual_save=False,
118
+ save_type=ArtifactSaveType.EXTERNAL,
118
119
  )
119
120
 
120
121
  # To avoid duplicate uploads, switch to referencing the uploaded
zenml/artifacts/utils.py CHANGED
@@ -39,6 +39,7 @@ from zenml.constants import (
39
39
  MODEL_METADATA_YAML_FILE_NAME,
40
40
  )
41
41
  from zenml.enums import (
42
+ ArtifactSaveType,
42
43
  ArtifactType,
43
44
  ExecutionStatus,
44
45
  MetadataResourceTypes,
@@ -82,6 +83,117 @@ logger = get_logger(__name__)
82
83
  # ----------
83
84
 
84
85
 
86
+ def _save_artifact_visualizations(
87
+ data: Any, materializer: "BaseMaterializer"
88
+ ) -> List[ArtifactVisualizationRequest]:
89
+ """Save artifact visualizations.
90
+
91
+ Args:
92
+ data: The data for which to save the visualizations.
93
+ materializer: The materializer that should be used to generate and
94
+ save the visualizations.
95
+
96
+ Returns:
97
+ List of requests for the saved visualizations.
98
+ """
99
+ try:
100
+ visualizations = materializer.save_visualizations(data)
101
+ except Exception as e:
102
+ logger.warning("Failed to save artifact visualizations: %s", e)
103
+ return []
104
+
105
+ return [
106
+ ArtifactVisualizationRequest(
107
+ type=type,
108
+ uri=uri,
109
+ )
110
+ for uri, type in visualizations.items()
111
+ ]
112
+
113
+
114
+ def _store_artifact_data_and_prepare_request(
115
+ data: Any,
116
+ name: str,
117
+ uri: str,
118
+ materializer_class: Type["BaseMaterializer"],
119
+ save_type: ArtifactSaveType,
120
+ version: Optional[Union[int, str]] = None,
121
+ tags: Optional[List[str]] = None,
122
+ store_metadata: bool = True,
123
+ store_visualizations: bool = True,
124
+ has_custom_name: bool = True,
125
+ metadata: Optional[Dict[str, "MetadataType"]] = None,
126
+ ) -> ArtifactVersionRequest:
127
+ """Store artifact data and prepare a request to the server.
128
+
129
+ Args:
130
+ data: The artifact data.
131
+ name: The artifact name.
132
+ uri: The artifact URI.
133
+ materializer_class: The materializer class to use for storing the
134
+ artifact data.
135
+ save_type: Save type of the artifact version.
136
+ version: The artifact version.
137
+ tags: Tags for the artifact version.
138
+ store_metadata: Whether to store metadata for the artifact version.
139
+ store_visualizations: Whether to store visualizations for the artifact
140
+ version.
141
+ has_custom_name: Whether the artifact has a custom name.
142
+ metadata: Metadata to store for the artifact version. This will be
143
+ ignored if `store_metadata` is set to `False`.
144
+
145
+ Returns:
146
+ Artifact version request for the artifact data that was stored.
147
+ """
148
+ artifact_store = Client().active_stack.artifact_store
149
+ artifact_store.makedirs(uri)
150
+
151
+ materializer = materializer_class(uri=uri, artifact_store=artifact_store)
152
+ materializer.uri = materializer.uri.replace("\\", "/")
153
+
154
+ data_type = type(data)
155
+ materializer.validate_save_type_compatibility(data_type)
156
+ materializer.save(data)
157
+
158
+ visualizations = (
159
+ _save_artifact_visualizations(data=data, materializer=materializer)
160
+ if store_visualizations
161
+ else None
162
+ )
163
+
164
+ combined_metadata: Dict[str, "MetadataType"] = {}
165
+ if store_metadata:
166
+ try:
167
+ combined_metadata = materializer.extract_full_metadata(data)
168
+ except Exception as e:
169
+ logger.warning("Failed to extract materializer metadata: %s", e)
170
+
171
+ # Update with user metadata to potentially overwrite values coming from
172
+ # the materializer
173
+ combined_metadata.update(metadata or {})
174
+
175
+ artifact_version_request = ArtifactVersionRequest(
176
+ artifact_name=name,
177
+ version=version,
178
+ tags=tags,
179
+ type=materializer.ASSOCIATED_ARTIFACT_TYPE,
180
+ uri=materializer.uri,
181
+ materializer=source_utils.resolve(materializer.__class__),
182
+ data_type=source_utils.resolve(data_type),
183
+ user=Client().active_user.id,
184
+ workspace=Client().active_workspace.id,
185
+ artifact_store_id=artifact_store.id,
186
+ visualizations=visualizations,
187
+ has_custom_name=has_custom_name,
188
+ save_type=save_type,
189
+ metadata=validate_metadata(combined_metadata)
190
+ if combined_metadata
191
+ else None,
192
+ )
193
+
194
+ return artifact_version_request
195
+
196
+
85
197
  def save_artifact(
86
198
  data: Any,
87
199
  name: str,
@@ -89,13 +201,14 @@ def save_artifact(
89
201
  tags: Optional[List[str]] = None,
90
202
  extract_metadata: bool = True,
91
203
  include_visualizations: bool = True,
92
- has_custom_name: bool = True,
93
204
  user_metadata: Optional[Dict[str, "MetadataType"]] = None,
94
205
  materializer: Optional["MaterializerClassOrSource"] = None,
95
206
  uri: Optional[str] = None,
96
207
  is_model_artifact: bool = False,
97
208
  is_deployment_artifact: bool = False,
98
- manual_save: bool = True,
209
+ # TODO: remove these once external artifact does not use this function anymore
210
+ save_type: ArtifactSaveType = ArtifactSaveType.MANUAL,
211
+ has_custom_name: bool = True,
99
212
  ) -> "ArtifactVersionResponse":
100
213
  """Upload and publish an artifact.
101
214
 
@@ -107,8 +220,6 @@ def save_artifact(
107
220
  tags: Tags to associate with the artifact.
108
221
  extract_metadata: If artifact metadata should be extracted and returned.
109
222
  include_visualizations: If artifact visualizations should be generated.
110
- has_custom_name: If the artifact name is custom and should be listed in
111
- the dashboard "Artifacts" tab.
112
223
  user_metadata: User-provided metadata to store with the artifact.
113
224
  materializer: The materializer to use for saving the artifact to the
114
225
  artifact store.
@@ -117,8 +228,9 @@ def save_artifact(
117
228
  `custom_artifacts/{name}/{version}`.
118
229
  is_model_artifact: If the artifact is a model artifact.
119
230
  is_deployment_artifact: If the artifact is a deployment artifact.
120
- manual_save: If this function is called manually and should therefore
121
- link the artifact to the current step run.
231
+ save_type: The type of save operation that created the artifact version.
232
+ has_custom_name: If the artifact name is custom and should be listed in
233
+ the dashboard "Artifacts" tab.
122
234
 
123
235
  Returns:
124
236
  The saved artifact response.
@@ -129,17 +241,14 @@ def save_artifact(
129
241
  from zenml.utils import source_utils
130
242
 
131
243
  client = Client()
132
-
133
- # Get the current artifact store
134
244
  artifact_store = client.active_stack.artifact_store
135
245
 
136
- # Build and check the artifact URI
137
246
  if not uri:
138
247
  uri = os.path.join("custom_artifacts", name, str(uuid4()))
139
248
  if not uri.startswith(artifact_store.path):
140
249
  uri = os.path.join(artifact_store.path, uri)
141
250
 
142
- if manual_save:
251
+ if save_type == ArtifactSaveType.MANUAL:
143
252
  # This check is only necessary for manual saves as we already check
144
253
  # it when creating the directory for step output artifacts
145
254
  _check_if_artifact_with_given_uri_already_registered(
@@ -147,9 +256,7 @@ def save_artifact(
147
256
  uri=uri,
148
257
  name=name,
149
258
  )
150
- artifact_store.makedirs(uri)
151
259
 
152
- # Find and initialize the right materializer class
153
260
  if isinstance(materializer, type):
154
261
  materializer_class = materializer
155
262
  elif materializer:
@@ -158,66 +265,25 @@ def save_artifact(
158
265
  )
159
266
  else:
160
267
  materializer_class = materializer_registry[type(data)]
161
- materializer_object = materializer_class(uri)
162
-
163
- # Force URIs to have forward slashes
164
- materializer_object.uri = materializer_object.uri.replace("\\", "/")
165
268
 
166
- # Save the artifact to the artifact store
167
- data_type = type(data)
168
- materializer_object.validate_save_type_compatibility(data_type)
169
- materializer_object.save(data)
170
-
171
- # Save visualizations of the artifact
172
- visualizations: List[ArtifactVisualizationRequest] = []
173
- if include_visualizations:
174
- try:
175
- vis_data = materializer_object.save_visualizations(data)
176
- for vis_uri, vis_type in vis_data.items():
177
- vis_model = ArtifactVisualizationRequest(
178
- type=vis_type,
179
- uri=vis_uri,
180
- )
181
- visualizations.append(vis_model)
182
- except Exception as e:
183
- logger.warning(
184
- f"Failed to save visualization for output artifact '{name}': "
185
- f"{e}"
186
- )
187
-
188
- # Save metadata of the artifact
189
- artifact_metadata: Dict[str, "MetadataType"] = {}
190
- if extract_metadata:
191
- try:
192
- artifact_metadata = materializer_object.extract_full_metadata(data)
193
- artifact_metadata.update(user_metadata or {})
194
- except Exception as e:
195
- logger.warning(
196
- f"Failed to extract metadata for output artifact '{name}': {e}"
197
- )
198
-
199
- artifact_version_request = ArtifactVersionRequest(
200
- artifact_name=name,
269
+ artifact_version_request = _store_artifact_data_and_prepare_request(
270
+ data=data,
271
+ name=name,
272
+ uri=uri,
273
+ materializer_class=materializer_class,
274
+ save_type=save_type,
201
275
  version=version,
202
276
  tags=tags,
203
- type=materializer_object.ASSOCIATED_ARTIFACT_TYPE,
204
- uri=materializer_object.uri,
205
- materializer=source_utils.resolve(materializer_object.__class__),
206
- data_type=source_utils.resolve(data_type),
207
- user=Client().active_user.id,
208
- workspace=Client().active_workspace.id,
209
- artifact_store_id=artifact_store.id,
210
- visualizations=visualizations,
277
+ store_metadata=extract_metadata,
278
+ store_visualizations=include_visualizations,
211
279
  has_custom_name=has_custom_name,
212
- metadata=validate_metadata(artifact_metadata)
213
- if artifact_metadata
214
- else None,
280
+ metadata=user_metadata,
215
281
  )
216
282
  artifact_version = client.zen_store.create_artifact_version(
217
283
  artifact_version=artifact_version_request
218
284
  )
219
285
 
220
- if manual_save:
286
+ if save_type == ArtifactSaveType.MANUAL:
221
287
  _link_artifact_version_to_the_step_and_model(
222
288
  artifact_version=artifact_version,
223
289
  is_model_artifact=is_model_artifact,
@@ -281,6 +347,7 @@ def register_artifact(
281
347
  version=version,
282
348
  tags=tags,
283
349
  type=ArtifactType.DATA,
350
+ save_type=ArtifactSaveType.PREEXISTING,
284
351
  uri=folder_or_file_uri,
285
352
  materializer=source_utils.resolve(PreexistingDataMaterializer),
286
353
  data_type=source_utils.resolve(Path),
@@ -320,17 +387,6 @@ def load_artifact(
320
387
  The loaded artifact.
321
388
  """
322
389
  artifact = Client().get_artifact_version(name_or_id, version)
323
- try:
324
- step_run = get_step_context().step_run
325
- client = Client()
326
- client.zen_store.update_run_step(
327
- step_run_id=step_run.id,
328
- step_run_update=StepRunUpdate(
329
- loaded_artifact_versions={artifact.name: artifact.id}
330
- ),
331
- )
332
- except RuntimeError:
333
- pass # Cannot link to step run if called outside of a step
334
390
  return load_artifact_from_response(artifact)
335
391
 
336
392
 
@@ -574,7 +630,8 @@ def get_artifacts_versions_of_pipeline_run(
574
630
  artifact_versions: List["ArtifactVersionResponse"] = []
575
631
  for step in pipeline_run.steps.values():
576
632
  if not only_produced or step.status == ExecutionStatus.COMPLETED:
577
- artifact_versions.extend(step.outputs.values())
633
+ for output in step.outputs.values():
634
+ artifact_versions.extend(output)
578
635
  return artifact_versions
579
636
 
580
637
 
@@ -635,9 +692,7 @@ def _link_artifact_version_to_the_step_and_model(
635
692
  client.zen_store.update_run_step(
636
693
  step_run_id=step_run.id,
637
694
  step_run_update=StepRunUpdate(
638
- saved_artifact_versions={
639
- artifact_version.artifact.name: artifact_version.id
640
- }
695
+ outputs={artifact_version.artifact.name: artifact_version.id}
641
696
  ),
642
697
  )
643
698
  error_message = "model"
zenml/cli/base.py CHANGED
@@ -79,19 +79,19 @@ class ZenMLProjectTemplateLocation(BaseModel):
79
79
  ZENML_PROJECT_TEMPLATES = dict(
80
80
  e2e_batch=ZenMLProjectTemplateLocation(
81
81
  github_url="zenml-io/template-e2e-batch",
82
- github_tag="2024.10.10", # Make sure it is aligned with .github/workflows/update-templates-to-examples.yml
82
+ github_tag="2024.10.30", # Make sure it is aligned with .github/workflows/update-templates-to-examples.yml
83
83
  ),
84
84
  starter=ZenMLProjectTemplateLocation(
85
85
  github_url="zenml-io/template-starter",
86
- github_tag="2024.09.24", # Make sure it is aligned with .github/workflows/update-templates-to-examples.yml
86
+ github_tag="2024.10.30", # Make sure it is aligned with .github/workflows/update-templates-to-examples.yml
87
87
  ),
88
88
  nlp=ZenMLProjectTemplateLocation(
89
89
  github_url="zenml-io/template-nlp",
90
- github_tag="2024.09.23", # Make sure it is aligned with .github/workflows/update-templates-to-examples.yml
90
+ github_tag="2024.10.30", # Make sure it is aligned with .github/workflows/update-templates-to-examples.yml
91
91
  ),
92
92
  llm_finetuning=ZenMLProjectTemplateLocation(
93
93
  github_url="zenml-io/template-llm-finetuning",
94
- github_tag="2024.09.24", # Make sure it is aligned with .github/workflows/update-templates-to-examples.yml
94
+ github_tag="2024.10.30", # Make sure it is aligned with .github/workflows/update-templates-to-examples.yml
95
95
  ),
96
96
  )
97
97
 
zenml/cli/model.py CHANGED
@@ -59,11 +59,6 @@ def _model_to_print(model: ModelResponse) -> Dict[str, Any]:
59
59
  def _model_version_to_print(
60
60
  model_version: ModelVersionResponse,
61
61
  ) -> Dict[str, Any]:
62
- run_metadata = None
63
- if model_version.run_metadata:
64
- run_metadata = {
65
- k: v.value for k, v in model_version.run_metadata.items()
66
- }
67
62
  return {
68
63
  "id": model_version.id,
69
64
  "model": model_version.model.name,
@@ -71,7 +66,7 @@ def _model_version_to_print(
71
66
  "number": model_version.number,
72
67
  "description": model_version.description,
73
68
  "stage": model_version.stage,
74
- "run_metadata": run_metadata,
69
+ "run_metadata": model_version.run_metadata,
75
70
  "tags": [t.name for t in model_version.tags],
76
71
  "data_artifacts_count": len(model_version.data_artifact_ids),
77
72
  "model_artifacts_count": len(model_version.model_artifact_ids),
zenml/cli/stack.py CHANGED
@@ -408,6 +408,7 @@ def register_stack(
408
408
  component_type, preset_name
409
409
  )
410
410
  component_info = component_response.id
411
+ component_name = component_response.name
411
412
  else:
412
413
  if isinstance(service_connector, UUID):
413
414
  # find existing components under same connector
zenml/client.py CHANGED
@@ -136,9 +136,7 @@ from zenml.models import (
136
136
  PipelineResponse,
137
137
  PipelineRunFilter,
138
138
  PipelineRunResponse,
139
- RunMetadataFilter,
140
139
  RunMetadataRequest,
141
- RunMetadataResponse,
142
140
  RunTemplateFilter,
143
141
  RunTemplateRequest,
144
142
  RunTemplateResponse,
@@ -190,6 +188,7 @@ from zenml.models import (
190
188
  WorkspaceResponse,
191
189
  WorkspaceUpdate,
192
190
  )
191
+ from zenml.models.v2.core.step_run import StepRunUpdate
193
192
  from zenml.services.service import ServiceConfig
194
193
  from zenml.services.service_status import ServiceState
195
194
  from zenml.services.service_type import ServiceType
@@ -4166,6 +4165,8 @@ class Client(metaclass=ClientMetaClass):
4166
4165
  Returns:
4167
4166
  The artifact version.
4168
4167
  """
4168
+ from zenml import get_step_context
4169
+
4169
4170
  if cll := client_lazy_loader(
4170
4171
  method_name="get_artifact_version",
4171
4172
  name_id_or_prefix=name_id_or_prefix,
@@ -4173,13 +4174,26 @@ class Client(metaclass=ClientMetaClass):
4173
4174
  hydrate=hydrate,
4174
4175
  ):
4175
4176
  return cll # type: ignore[return-value]
4176
- return self._get_entity_version_by_id_or_name_or_prefix(
4177
+
4178
+ artifact = self._get_entity_version_by_id_or_name_or_prefix(
4177
4179
  get_method=self.zen_store.get_artifact_version,
4178
4180
  list_method=self.list_artifact_versions,
4179
4181
  name_id_or_prefix=name_id_or_prefix,
4180
4182
  version=version,
4181
4183
  hydrate=hydrate,
4182
4184
  )
4185
+ try:
4186
+ step_run = get_step_context().step_run
4187
+ client = Client()
4188
+ client.zen_store.update_run_step(
4189
+ step_run_id=step_run.id,
4190
+ step_run_update=StepRunUpdate(
4191
+ loaded_artifact_versions={artifact.name: artifact.id}
4192
+ ),
4193
+ )
4194
+ except RuntimeError:
4195
+ pass # Cannot link to step run if called outside of a step
4196
+ return artifact
4183
4197
 
4184
4198
  def list_artifact_versions(
4185
4199
  self,
@@ -4417,7 +4431,7 @@ class Client(metaclass=ClientMetaClass):
4417
4431
  resource_id: UUID,
4418
4432
  resource_type: MetadataResourceTypes,
4419
4433
  stack_component_id: Optional[UUID] = None,
4420
- ) -> List[RunMetadataResponse]:
4434
+ ) -> None:
4421
4435
  """Create run metadata.
4422
4436
 
4423
4437
  Args:
@@ -4430,7 +4444,7 @@ class Client(metaclass=ClientMetaClass):
4430
4444
  the metadata.
4431
4445
 
4432
4446
  Returns:
4433
- The created metadata, as string to model dictionary.
4447
+ None
4434
4448
  """
4435
4449
  from zenml.metadata.metadata_types import get_metadata_type
4436
4450
 
@@ -4465,74 +4479,8 @@ class Client(metaclass=ClientMetaClass):
4465
4479
  values=values,
4466
4480
  types=types,
4467
4481
  )
4468
- return self.zen_store.create_run_metadata(run_metadata)
4469
-
4470
- def list_run_metadata(
4471
- self,
4472
- sort_by: str = "created",
4473
- page: int = PAGINATION_STARTING_PAGE,
4474
- size: int = PAGE_SIZE_DEFAULT,
4475
- logical_operator: LogicalOperators = LogicalOperators.AND,
4476
- id: Optional[Union[UUID, str]] = None,
4477
- created: Optional[Union[datetime, str]] = None,
4478
- updated: Optional[Union[datetime, str]] = None,
4479
- workspace_id: Optional[UUID] = None,
4480
- user_id: Optional[UUID] = None,
4481
- resource_id: Optional[UUID] = None,
4482
- resource_type: Optional[MetadataResourceTypes] = None,
4483
- stack_component_id: Optional[UUID] = None,
4484
- key: Optional[str] = None,
4485
- value: Optional["MetadataType"] = None,
4486
- type: Optional[str] = None,
4487
- hydrate: bool = False,
4488
- ) -> Page[RunMetadataResponse]:
4489
- """List run metadata.
4490
-
4491
- Args:
4492
- sort_by: The field to sort the results by.
4493
- page: The page number to return.
4494
- size: The number of results to return per page.
4495
- logical_operator: The logical operator to use for filtering.
4496
- id: The ID of the metadata.
4497
- created: The creation time of the metadata.
4498
- updated: The last update time of the metadata.
4499
- workspace_id: The ID of the workspace the metadata belongs to.
4500
- user_id: The ID of the user that created the metadata.
4501
- resource_id: The ID of the resource the metadata belongs to.
4502
- resource_type: The type of the resource the metadata belongs to.
4503
- stack_component_id: The ID of the stack component that produced
4504
- the metadata.
4505
- key: The key of the metadata.
4506
- value: The value of the metadata.
4507
- type: The type of the metadata.
4508
- hydrate: Flag deciding whether to hydrate the output model(s)
4509
- by including metadata fields in the response.
4510
-
4511
- Returns:
4512
- The run metadata.
4513
- """
4514
- metadata_filter_model = RunMetadataFilter(
4515
- sort_by=sort_by,
4516
- page=page,
4517
- size=size,
4518
- logical_operator=logical_operator,
4519
- id=id,
4520
- created=created,
4521
- updated=updated,
4522
- workspace_id=workspace_id,
4523
- user_id=user_id,
4524
- resource_id=resource_id,
4525
- resource_type=resource_type,
4526
- stack_component_id=stack_component_id,
4527
- key=key,
4528
- value=value,
4529
- type=type,
4530
- )
4531
- metadata_filter_model.set_scope_workspace(self.active_workspace.id)
4532
- return self.zen_store.list_run_metadata(
4533
- metadata_filter_model,
4534
- hydrate=hydrate,
4535
- )
4482
+ self.zen_store.create_run_metadata(run_metadata)
4483
+ return None
4536
4484
 
4537
4485
  # -------------------------------- Secrets ---------------------------------
4538
4486
 
zenml/constants.py CHANGED
@@ -338,6 +338,7 @@ ARTIFACTS = "/artifacts"
338
338
  ARTIFACT_VERSIONS = "/artifact_versions"
339
339
  ARTIFACT_VISUALIZATIONS = "/artifact_visualizations"
340
340
  AUTH = "/auth"
341
+ BATCH = "/batch"
341
342
  CODE_REFERENCES = "/code_references"
342
343
  CODE_REPOSITORIES = "/code_repositories"
343
344
  COMPONENT_TYPES = "/component-types"
zenml/enums.py CHANGED
@@ -34,15 +34,23 @@ class ArtifactType(StrEnum):
34
34
  class StepRunInputArtifactType(StrEnum):
35
35
  """All possible types of a step run input artifact."""
36
36
 
37
- DEFAULT = "default" # input argument that is the output of a previous step
37
+ STEP_OUTPUT = (
38
+ "step_output" # input argument that is the output of a previous step
39
+ )
38
40
  MANUAL = "manual" # manually loaded via `zenml.load_artifact()`
41
+ EXTERNAL = "external" # loaded via `ExternalArtifact(value=...)`
42
+ LAZY_LOADED = "lazy" # loaded via various lazy methods
39
43
 
40
44
 
41
- class StepRunOutputArtifactType(StrEnum):
42
- """All possible types of a step run output artifact."""
45
+ class ArtifactSaveType(StrEnum):
46
+ """All possible method types of how artifact versions can be saved."""
43
47
 
44
- DEFAULT = "default" # output of the current step
48
+ STEP_OUTPUT = "step_output" # output of the current step
45
49
  MANUAL = "manual" # manually saved via `zenml.save_artifact()`
50
+ PREEXISTING = "preexisting" # register via `zenml.register_artifact()`
51
+ EXTERNAL = (
52
+ "external" # saved via `zenml.ExternalArtifact.upload_by_value()`
53
+ )
46
54
 
47
55
 
48
56
  class VisualizationType(StrEnum):
@@ -566,7 +566,7 @@ class SagemakerOrchestrator(ContainerizedOrchestrator):
566
566
 
567
567
  # Fetch the status of the _PipelineExecution
568
568
  if METADATA_ORCHESTRATOR_RUN_ID in run.run_metadata:
569
- run_id = run.run_metadata[METADATA_ORCHESTRATOR_RUN_ID].value
569
+ run_id = run.run_metadata[METADATA_ORCHESTRATOR_RUN_ID]
570
570
  elif run.orchestrator_run_id is not None:
571
571
  run_id = run.orchestrator_run_id
572
572
  else:
@@ -482,7 +482,7 @@ class AzureMLOrchestrator(ContainerizedOrchestrator):
482
482
 
483
483
  # Fetch the status of the PipelineJob
484
484
  if METADATA_ORCHESTRATOR_RUN_ID in run.run_metadata:
485
- run_id = run.run_metadata[METADATA_ORCHESTRATOR_RUN_ID].value
485
+ run_id = run.run_metadata[METADATA_ORCHESTRATOR_RUN_ID]
486
486
  elif run.orchestrator_run_id is not None:
487
487
  run_id = run.orchestrator_run_id
488
488
  else:
@@ -33,7 +33,7 @@ from zenml.stack import Flavor
33
33
 
34
34
  # Fix numba errors in Docker and suppress logs and deprecation warning spam
35
35
  try:
36
- from numba.core.errors import ( # type: ignore[import-not-found]
36
+ from numba.core.errors import (
37
37
  NumbaDeprecationWarning,
38
38
  NumbaPendingDeprecationWarning,
39
39
  )
@@ -835,7 +835,7 @@ class VertexOrchestrator(ContainerizedOrchestrator, GoogleCredentialsMixin):
835
835
 
836
836
  # Fetch the status of the PipelineJob
837
837
  if METADATA_ORCHESTRATOR_RUN_ID in run.run_metadata:
838
- run_id = run.run_metadata[METADATA_ORCHESTRATOR_RUN_ID].value
838
+ run_id = run.run_metadata[METADATA_ORCHESTRATOR_RUN_ID]
839
839
  elif run.orchestrator_run_id is not None:
840
840
  run_id = run.orchestrator_run_id
841
841
  else: