zenml-nightly 0.70.0.dev20241129__py3-none-any.whl → 0.70.0.dev20241130__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.
- zenml/VERSION +1 -1
- zenml/artifacts/artifact_config.py +0 -14
- zenml/artifacts/utils.py +50 -29
- zenml/cli/__init__.py +15 -0
- zenml/cli/base.py +4 -4
- zenml/cli/server.py +1 -1
- zenml/cli/stack.py +0 -3
- zenml/cli/stack_components.py +0 -1
- zenml/cli/utils.py +0 -5
- zenml/client.py +8 -18
- zenml/model/model.py +8 -4
- zenml/model/utils.py +18 -16
- zenml/models/__init__.py +6 -0
- zenml/models/v2/core/artifact_version.py +6 -3
- zenml/models/v2/core/component.py +0 -22
- zenml/models/v2/core/model_version.py +6 -3
- zenml/models/v2/core/pipeline_run.py +16 -4
- zenml/models/v2/core/run_metadata.py +30 -9
- zenml/models/v2/core/step_run.py +5 -3
- zenml/models/v2/misc/run_metadata.py +38 -0
- zenml/orchestrators/input_utils.py +19 -6
- zenml/orchestrators/publish_utils.py +11 -4
- zenml/orchestrators/step_launcher.py +2 -2
- zenml/orchestrators/step_run_utils.py +3 -0
- zenml/orchestrators/step_runner.py +7 -8
- zenml/orchestrators/utils.py +0 -24
- zenml/pipelines/run_utils.py +3 -4
- zenml/steps/utils.py +6 -2
- zenml/utils/metadata_utils.py +186 -153
- zenml/utils/string_utils.py +15 -8
- zenml/zen_server/routers/workspaces_endpoints.py +19 -19
- zenml/zen_stores/migrations/versions/b73bc71f1106_remove_component_spec_path.py +36 -0
- zenml/zen_stores/migrations/versions/cc269488e5a9_separate_run_metadata.py +135 -0
- zenml/zen_stores/schemas/__init__.py +5 -1
- zenml/zen_stores/schemas/artifact_schemas.py +10 -10
- zenml/zen_stores/schemas/component_schemas.py +0 -3
- zenml/zen_stores/schemas/model_schemas.py +13 -11
- zenml/zen_stores/schemas/pipeline_run_schemas.py +32 -15
- zenml/zen_stores/schemas/run_metadata_schemas.py +66 -31
- zenml/zen_stores/schemas/step_run_schemas.py +13 -12
- zenml/zen_stores/schemas/utils.py +47 -3
- zenml/zen_stores/sql_zen_store.py +102 -23
- {zenml_nightly-0.70.0.dev20241129.dist-info → zenml_nightly-0.70.0.dev20241130.dist-info}/METADATA +1 -1
- {zenml_nightly-0.70.0.dev20241129.dist-info → zenml_nightly-0.70.0.dev20241130.dist-info}/RECORD +47 -44
- {zenml_nightly-0.70.0.dev20241129.dist-info → zenml_nightly-0.70.0.dev20241130.dist-info}/LICENSE +0 -0
- {zenml_nightly-0.70.0.dev20241129.dist-info → zenml_nightly-0.70.0.dev20241130.dist-info}/WHEEL +0 -0
- {zenml_nightly-0.70.0.dev20241129.dist-info → zenml_nightly-0.70.0.dev20241130.dist-info}/entry_points.txt +0 -0
zenml/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.70.0.
|
1
|
+
0.70.0.dev20241130
|
@@ -21,7 +21,6 @@ from zenml.enums import ArtifactType
|
|
21
21
|
from zenml.logger import get_logger
|
22
22
|
from zenml.metadata.metadata_types import MetadataType
|
23
23
|
from zenml.utils.pydantic_utils import before_validator_handler
|
24
|
-
from zenml.utils.string_utils import format_name_template
|
25
24
|
|
26
25
|
logger = get_logger(__name__)
|
27
26
|
|
@@ -118,16 +117,3 @@ class ArtifactConfig(BaseModel):
|
|
118
117
|
data.setdefault("artifact_type", ArtifactType.SERVICE)
|
119
118
|
|
120
119
|
return data
|
121
|
-
|
122
|
-
def _evaluated_name(self, substitutions: Dict[str, str]) -> Optional[str]:
|
123
|
-
"""Evaluated name of the artifact.
|
124
|
-
|
125
|
-
Args:
|
126
|
-
substitutions: Extra placeholders to use in the name template.
|
127
|
-
|
128
|
-
Returns:
|
129
|
-
The evaluated name of the artifact.
|
130
|
-
"""
|
131
|
-
if self.name:
|
132
|
-
return format_name_template(self.name, substitutions=substitutions)
|
133
|
-
return self.name
|
zenml/artifacts/utils.py
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
"""Utility functions for handling artifacts."""
|
15
15
|
|
16
16
|
import base64
|
17
|
+
import contextlib
|
17
18
|
import os
|
18
19
|
import tempfile
|
19
20
|
import zipfile
|
@@ -41,7 +42,6 @@ from zenml.enums import (
|
|
41
42
|
ArtifactSaveType,
|
42
43
|
ArtifactType,
|
43
44
|
ExecutionStatus,
|
44
|
-
MetadataResourceTypes,
|
45
45
|
StackComponentType,
|
46
46
|
VisualizationType,
|
47
47
|
)
|
@@ -404,50 +404,71 @@ def log_artifact_metadata(
|
|
404
404
|
artifact_version: The version of the artifact to log metadata for. If
|
405
405
|
not provided, when being called inside a step that produces an
|
406
406
|
artifact named `artifact_name`, the metadata will be associated to
|
407
|
-
the corresponding newly created artifact.
|
408
|
-
being called outside a step, or in a step that does not produce
|
409
|
-
any artifact named `artifact_name`, the metadata will be associated
|
410
|
-
to the latest version of that artifact.
|
407
|
+
the corresponding newly created artifact.
|
411
408
|
|
412
409
|
Raises:
|
413
410
|
ValueError: If no artifact name is provided and the function is not
|
414
411
|
called inside a step with a single output, or, if neither an
|
415
412
|
artifact nor an output with the given name exists.
|
413
|
+
|
416
414
|
"""
|
417
415
|
logger.warning(
|
418
416
|
"The `log_artifact_metadata` function is deprecated and will soon be "
|
419
417
|
"removed. Please use `log_metadata` instead."
|
420
418
|
)
|
421
|
-
|
419
|
+
|
420
|
+
from zenml import log_metadata
|
421
|
+
|
422
|
+
if artifact_name and artifact_version:
|
423
|
+
assert artifact_name is not None
|
424
|
+
|
425
|
+
log_metadata(
|
426
|
+
metadata=metadata,
|
427
|
+
artifact_name=artifact_name,
|
428
|
+
artifact_version=artifact_version,
|
429
|
+
)
|
430
|
+
|
431
|
+
step_context = None
|
432
|
+
with contextlib.suppress(RuntimeError):
|
422
433
|
step_context = get_step_context()
|
423
|
-
|
424
|
-
|
434
|
+
|
435
|
+
if step_context and artifact_name in step_context._outputs.keys():
|
436
|
+
log_metadata(
|
437
|
+
metadata=metadata,
|
438
|
+
artifact_name=artifact_name,
|
439
|
+
infer_artifact=True,
|
425
440
|
)
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
)
|
441
|
+
elif step_context and len(step_context._outputs) == 1:
|
442
|
+
single_output_name = list(step_context._outputs.keys())[0]
|
443
|
+
|
444
|
+
log_metadata(
|
445
|
+
metadata=metadata,
|
446
|
+
artifact_name=single_output_name,
|
447
|
+
infer_artifact=True,
|
448
|
+
)
|
449
|
+
elif artifact_name:
|
436
450
|
client = Client()
|
437
|
-
|
438
|
-
|
451
|
+
logger.warning(
|
452
|
+
"Deprecation warning! Currently, you are calling "
|
453
|
+
"`log_artifact_metadata` from a context, where we use the "
|
454
|
+
"`artifact_name` to fetch it and link the metadata to its "
|
455
|
+
"latest version. This behavior is deprecated and will be "
|
456
|
+
"removed in the future. To circumvent this, please check"
|
457
|
+
"the `log_metadata` function."
|
458
|
+
)
|
459
|
+
artifact_version_model = client.get_artifact_version(
|
460
|
+
name_id_or_prefix=artifact_name
|
461
|
+
)
|
462
|
+
log_metadata(
|
439
463
|
metadata=metadata,
|
440
|
-
|
441
|
-
resource_type=MetadataResourceTypes.ARTIFACT_VERSION,
|
464
|
+
artifact_version_id=artifact_version_model.id,
|
442
465
|
)
|
443
|
-
|
444
466
|
else:
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
)
|
449
|
-
|
450
|
-
raise ValueError(e)
|
467
|
+
raise ValueError(
|
468
|
+
"You need to call `log_artifact_metadata` either within a step "
|
469
|
+
"(potentially with an artifact name) or outside of a step with an "
|
470
|
+
"artifact name (and/or version)."
|
471
|
+
)
|
451
472
|
|
452
473
|
|
453
474
|
# -----------------
|
zenml/cli/__init__.py
CHANGED
@@ -2410,6 +2410,21 @@ stack, use the `--stack` option.
|
|
2410
2410
|
zenml pipeline run <PIPELINE_SOURCE_PATH> --stack=<STACK_ID_OR_NAME>
|
2411
2411
|
```
|
2412
2412
|
|
2413
|
+
If you want to create a run template based on your pipeline that can later be used to trigger a run either from the dashboard or through an HTTP request:
|
2414
|
+
|
2415
|
+
```bash
|
2416
|
+
zenml pipeline create-run-template <PIPELINE_SOURCE_PATH> \
|
2417
|
+
--name=<TEMPLATE_NAME>
|
2418
|
+
|
2419
|
+
To specify a config file, use the `--config/-c` option. If you would like to use a different stack than the active one, use the `--stack` option.
|
2420
|
+
|
2421
|
+
```bash
|
2422
|
+
zenml pipeline create-run-template <PIPELINE_SOURCE_PATH> \
|
2423
|
+
--name=<TEMPLATE_NAME> \
|
2424
|
+
--config=<PATH_TO_CONFIG_YAML> \
|
2425
|
+
--stack=<STACK_ID_OR_NAME>
|
2426
|
+
```
|
2427
|
+
|
2413
2428
|
Tagging your resources with ZenML
|
2414
2429
|
---------------------------------
|
2415
2430
|
|
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.11.
|
82
|
+
github_tag="2024.11.28", # 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.
|
86
|
+
github_tag="2024.11.28", # 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.
|
90
|
+
github_tag="2024.11.28", # 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.11.
|
94
|
+
github_tag="2024.11.28", # Make sure it is aligned with .github/workflows/update-templates-to-examples.yml
|
95
95
|
),
|
96
96
|
)
|
97
97
|
|
zenml/cli/server.py
CHANGED
@@ -469,7 +469,7 @@ def logs(
|
|
469
469
|
if server is None:
|
470
470
|
cli_utils.error(
|
471
471
|
"The local ZenML dashboard is not running. Please call `zenml "
|
472
|
-
"
|
472
|
+
"login --local` first to start the ZenML dashboard locally."
|
473
473
|
)
|
474
474
|
|
475
475
|
from zenml.zen_server.deploy.deployer import LocalServerDeployer
|
zenml/cli/stack.py
CHANGED
@@ -1129,14 +1129,12 @@ def export_stack(
|
|
1129
1129
|
def _import_stack_component(
|
1130
1130
|
component_type: StackComponentType,
|
1131
1131
|
component_dict: Dict[str, Any],
|
1132
|
-
component_spec_path: Optional[str] = None,
|
1133
1132
|
) -> UUID:
|
1134
1133
|
"""Import a single stack component with given type/config.
|
1135
1134
|
|
1136
1135
|
Args:
|
1137
1136
|
component_type: The type of component to import.
|
1138
1137
|
component_dict: Dict representation of the component to import.
|
1139
|
-
component_spec_path: Path to the component spec file.
|
1140
1138
|
|
1141
1139
|
Returns:
|
1142
1140
|
The ID of the imported component.
|
@@ -1172,7 +1170,6 @@ def _import_stack_component(
|
|
1172
1170
|
component_type=component_type,
|
1173
1171
|
flavor=flavor,
|
1174
1172
|
configuration=config,
|
1175
|
-
component_spec_path=component_spec_path,
|
1176
1173
|
)
|
1177
1174
|
return component.id
|
1178
1175
|
|
zenml/cli/stack_components.py
CHANGED
@@ -573,7 +573,6 @@ def generate_stack_component_copy_command(
|
|
573
573
|
component_type=component_to_copy.type,
|
574
574
|
configuration=component_to_copy.configuration,
|
575
575
|
labels=component_to_copy.labels,
|
576
|
-
component_spec_path=component_to_copy.component_spec_path,
|
577
576
|
)
|
578
577
|
print_model_url(get_component_url(copied_component))
|
579
578
|
|
zenml/cli/utils.py
CHANGED
@@ -711,11 +711,6 @@ def print_stack_component_configuration(
|
|
711
711
|
|
712
712
|
console.print(rich_table)
|
713
713
|
|
714
|
-
if component.component_spec_path:
|
715
|
-
declare(
|
716
|
-
f"Component spec path for `mlstacks`: {component.component_spec_path}"
|
717
|
-
)
|
718
|
-
|
719
714
|
|
720
715
|
def expand_argument_value_from_file(name: str, value: str) -> str:
|
721
716
|
"""Expands the value of an argument pointing to a file into the contents of that file.
|
zenml/client.py
CHANGED
@@ -60,7 +60,6 @@ from zenml.constants import (
|
|
60
60
|
from zenml.enums import (
|
61
61
|
ArtifactType,
|
62
62
|
LogicalOperators,
|
63
|
-
MetadataResourceTypes,
|
64
63
|
ModelStages,
|
65
64
|
OAuthDeviceStatus,
|
66
65
|
PluginSubType,
|
@@ -137,6 +136,7 @@ from zenml.models import (
|
|
137
136
|
PipelineRunFilter,
|
138
137
|
PipelineRunResponse,
|
139
138
|
RunMetadataRequest,
|
139
|
+
RunMetadataResource,
|
140
140
|
RunTemplateFilter,
|
141
141
|
RunTemplateRequest,
|
142
142
|
RunTemplateResponse,
|
@@ -1979,7 +1979,6 @@ class Client(metaclass=ClientMetaClass):
|
|
1979
1979
|
flavor: str,
|
1980
1980
|
component_type: StackComponentType,
|
1981
1981
|
configuration: Dict[str, str],
|
1982
|
-
component_spec_path: Optional[str] = None,
|
1983
1982
|
labels: Optional[Dict[str, Any]] = None,
|
1984
1983
|
) -> "ComponentResponse":
|
1985
1984
|
"""Registers a stack component.
|
@@ -1987,7 +1986,6 @@ class Client(metaclass=ClientMetaClass):
|
|
1987
1986
|
Args:
|
1988
1987
|
name: The name of the stack component.
|
1989
1988
|
flavor: The flavor of the stack component.
|
1990
|
-
component_spec_path: The path to the stack spec file.
|
1991
1989
|
component_type: The type of the stack component.
|
1992
1990
|
configuration: The configuration of the stack component.
|
1993
1991
|
labels: The labels of the stack component.
|
@@ -2016,7 +2014,6 @@ class Client(metaclass=ClientMetaClass):
|
|
2016
2014
|
name=name,
|
2017
2015
|
type=component_type,
|
2018
2016
|
flavor=flavor,
|
2019
|
-
component_spec_path=component_spec_path,
|
2020
2017
|
configuration=configuration,
|
2021
2018
|
user=self.active_user.id,
|
2022
2019
|
workspace=self.active_workspace.id,
|
@@ -2033,7 +2030,6 @@ class Client(metaclass=ClientMetaClass):
|
|
2033
2030
|
name_id_or_prefix: Optional[Union[UUID, str]],
|
2034
2031
|
component_type: StackComponentType,
|
2035
2032
|
name: Optional[str] = None,
|
2036
|
-
component_spec_path: Optional[str] = None,
|
2037
2033
|
configuration: Optional[Dict[str, Any]] = None,
|
2038
2034
|
labels: Optional[Dict[str, Any]] = None,
|
2039
2035
|
disconnect: Optional[bool] = None,
|
@@ -2047,7 +2043,6 @@ class Client(metaclass=ClientMetaClass):
|
|
2047
2043
|
update.
|
2048
2044
|
component_type: The type of the stack component to update.
|
2049
2045
|
name: The new name of the stack component.
|
2050
|
-
component_spec_path: The new path to the stack spec file.
|
2051
2046
|
configuration: The new configuration of the stack component.
|
2052
2047
|
labels: The new labels of the stack component.
|
2053
2048
|
disconnect: Whether to disconnect the stack component from its
|
@@ -2072,7 +2067,6 @@ class Client(metaclass=ClientMetaClass):
|
|
2072
2067
|
update_model = ComponentUpdate(
|
2073
2068
|
workspace=self.active_workspace.id,
|
2074
2069
|
user=self.active_user.id,
|
2075
|
-
component_spec_path=component_spec_path,
|
2076
2070
|
)
|
2077
2071
|
|
2078
2072
|
if name is not None:
|
@@ -4438,23 +4432,20 @@ class Client(metaclass=ClientMetaClass):
|
|
4438
4432
|
def create_run_metadata(
|
4439
4433
|
self,
|
4440
4434
|
metadata: Dict[str, "MetadataType"],
|
4441
|
-
|
4442
|
-
resource_type: MetadataResourceTypes,
|
4435
|
+
resources: List[RunMetadataResource],
|
4443
4436
|
stack_component_id: Optional[UUID] = None,
|
4437
|
+
publisher_step_id: Optional[UUID] = None,
|
4444
4438
|
) -> None:
|
4445
4439
|
"""Create run metadata.
|
4446
4440
|
|
4447
4441
|
Args:
|
4448
4442
|
metadata: The metadata to create as a dictionary of key-value pairs.
|
4449
|
-
|
4450
|
-
metadata was produced.
|
4451
|
-
resource_type: The type of the resource for which the
|
4443
|
+
resources: The list of IDs and types of the resources for that the
|
4452
4444
|
metadata was produced.
|
4453
4445
|
stack_component_id: The ID of the stack component that produced
|
4454
4446
|
the metadata.
|
4455
|
-
|
4456
|
-
|
4457
|
-
None
|
4447
|
+
publisher_step_id: The ID of the step execution that publishes
|
4448
|
+
this metadata automatically.
|
4458
4449
|
"""
|
4459
4450
|
from zenml.metadata.metadata_types import get_metadata_type
|
4460
4451
|
|
@@ -4483,14 +4474,13 @@ class Client(metaclass=ClientMetaClass):
|
|
4483
4474
|
run_metadata = RunMetadataRequest(
|
4484
4475
|
workspace=self.active_workspace.id,
|
4485
4476
|
user=self.active_user.id,
|
4486
|
-
|
4487
|
-
resource_type=resource_type,
|
4477
|
+
resources=resources,
|
4488
4478
|
stack_component_id=stack_component_id,
|
4479
|
+
publisher_step_id=publisher_step_id,
|
4489
4480
|
values=values,
|
4490
4481
|
types=types,
|
4491
4482
|
)
|
4492
4483
|
self.zen_store.create_run_metadata(run_metadata)
|
4493
|
-
return None
|
4494
4484
|
|
4495
4485
|
# -------------------------------- Secrets ---------------------------------
|
4496
4486
|
|
zenml/model/model.py
CHANGED
@@ -336,12 +336,16 @@ class Model(BaseModel):
|
|
336
336
|
metadata: The metadata to log.
|
337
337
|
"""
|
338
338
|
from zenml.client import Client
|
339
|
+
from zenml.models import RunMetadataResource
|
339
340
|
|
340
341
|
response = self._get_or_create_model_version()
|
341
342
|
Client().create_run_metadata(
|
342
343
|
metadata=metadata,
|
343
|
-
|
344
|
-
|
344
|
+
resources=[
|
345
|
+
RunMetadataResource(
|
346
|
+
id=response.id, type=MetadataResourceTypes.MODEL_VERSION
|
347
|
+
)
|
348
|
+
],
|
345
349
|
)
|
346
350
|
|
347
351
|
@property
|
@@ -537,7 +541,7 @@ class Model(BaseModel):
|
|
537
541
|
|
538
542
|
zenml_client = Client()
|
539
543
|
# backup logic, if the Model class is used directly from the code
|
540
|
-
self.name = format_name_template(self.name
|
544
|
+
self.name = format_name_template(self.name)
|
541
545
|
if self.model_version_id:
|
542
546
|
mv = zenml_client.get_model_version(
|
543
547
|
model_version_name_or_number_or_id=self.model_version_id,
|
@@ -667,7 +671,7 @@ class Model(BaseModel):
|
|
667
671
|
|
668
672
|
# backup logic, if the Model class is used directly from the code
|
669
673
|
if isinstance(self.version, str):
|
670
|
-
self.version = format_name_template(self.version
|
674
|
+
self.version = format_name_template(self.version)
|
671
675
|
|
672
676
|
try:
|
673
677
|
if self.version or self.model_version_id:
|
zenml/model/utils.py
CHANGED
@@ -52,29 +52,31 @@ def log_model_metadata(
|
|
52
52
|
`model` in decorator.
|
53
53
|
|
54
54
|
Raises:
|
55
|
-
ValueError: If
|
56
|
-
called inside a step with configured `model` in decorator.
|
55
|
+
ValueError: If the function is not called with proper input.
|
57
56
|
"""
|
58
57
|
logger.warning(
|
59
58
|
"The `log_model_metadata` function is deprecated and will soon be "
|
60
59
|
"removed. Please use `log_metadata` instead."
|
61
60
|
)
|
62
61
|
|
63
|
-
|
64
|
-
from zenml import Model
|
62
|
+
from zenml import log_metadata
|
65
63
|
|
66
|
-
|
64
|
+
if model_name and model_version:
|
65
|
+
log_metadata(
|
66
|
+
metadata=metadata,
|
67
|
+
model_version=model_version,
|
68
|
+
model_name=model_name,
|
69
|
+
)
|
70
|
+
elif model_name is None and model_version is None:
|
71
|
+
log_metadata(
|
72
|
+
metadata=metadata,
|
73
|
+
infer_model=True,
|
74
|
+
)
|
67
75
|
else:
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
"Model name and version must be provided unless the function is "
|
73
|
-
"called inside a step with configured `model` in decorator."
|
74
|
-
)
|
75
|
-
mv = step_context.model
|
76
|
-
|
77
|
-
mv.log_metadata(metadata)
|
76
|
+
raise ValueError(
|
77
|
+
"You can call `log_model_metadata` by either providing both "
|
78
|
+
"`model_name` and `model_version` or keeping both of them None."
|
79
|
+
)
|
78
80
|
|
79
81
|
|
80
82
|
def link_artifact_version_to_model_version(
|
@@ -107,7 +109,7 @@ def link_artifact_to_model(
|
|
107
109
|
model: The model to link to.
|
108
110
|
|
109
111
|
Raises:
|
110
|
-
RuntimeError: If called outside
|
112
|
+
RuntimeError: If called outside a step.
|
111
113
|
"""
|
112
114
|
if not model:
|
113
115
|
is_issue = False
|
zenml/models/__init__.py
CHANGED
@@ -372,6 +372,10 @@ from zenml.models.v2.misc.auth_models import (
|
|
372
372
|
OAuthRedirectResponse,
|
373
373
|
OAuthTokenResponse,
|
374
374
|
)
|
375
|
+
from zenml.models.v2.misc.run_metadata import (
|
376
|
+
RunMetadataEntry,
|
377
|
+
RunMetadataResource,
|
378
|
+
)
|
375
379
|
from zenml.models.v2.misc.server_models import (
|
376
380
|
ServerModel,
|
377
381
|
ServerDatabaseType,
|
@@ -752,4 +756,6 @@ __all__ = [
|
|
752
756
|
"ServiceConnectorInfo",
|
753
757
|
"ServiceConnectorResourcesInfo",
|
754
758
|
"ResourcesInfo",
|
759
|
+
"RunMetadataEntry",
|
760
|
+
"RunMetadataResource",
|
755
761
|
]
|
@@ -576,6 +576,7 @@ class ArtifactVersionFilter(WorkspaceScopedTaggableFilter):
|
|
576
576
|
ModelVersionArtifactSchema,
|
577
577
|
ModelVersionSchema,
|
578
578
|
PipelineRunSchema,
|
579
|
+
RunMetadataResourceSchema,
|
579
580
|
RunMetadataSchema,
|
580
581
|
StepRunInputArtifactSchema,
|
581
582
|
StepRunOutputArtifactSchema,
|
@@ -679,10 +680,12 @@ class ArtifactVersionFilter(WorkspaceScopedTaggableFilter):
|
|
679
680
|
|
680
681
|
for key, value in self.run_metadata.items():
|
681
682
|
additional_filter = and_(
|
682
|
-
|
683
|
-
|
683
|
+
RunMetadataResourceSchema.resource_id
|
684
|
+
== ArtifactVersionSchema.id,
|
685
|
+
RunMetadataResourceSchema.resource_type
|
684
686
|
== MetadataResourceTypes.ARTIFACT_VERSION,
|
685
|
-
|
687
|
+
RunMetadataResourceSchema.run_metadata_id
|
688
|
+
== RunMetadataSchema.id,
|
686
689
|
self.generate_custom_query_conditions_for_column(
|
687
690
|
value=value,
|
688
691
|
table=RunMetadataSchema,
|
@@ -81,11 +81,6 @@ class ComponentBase(BaseModel):
|
|
81
81
|
title="The stack component labels.",
|
82
82
|
)
|
83
83
|
|
84
|
-
component_spec_path: Optional[str] = Field(
|
85
|
-
default=None,
|
86
|
-
title="The path to the component spec used for mlstacks deployments.",
|
87
|
-
)
|
88
|
-
|
89
84
|
|
90
85
|
# ------------------ Request Model ------------------
|
91
86
|
|
@@ -155,10 +150,6 @@ class ComponentUpdate(BaseUpdate):
|
|
155
150
|
title="The stack component labels.",
|
156
151
|
default=None,
|
157
152
|
)
|
158
|
-
component_spec_path: Optional[str] = Field(
|
159
|
-
title="The path to the component spec used for mlstacks deployments.",
|
160
|
-
default=None,
|
161
|
-
)
|
162
153
|
connector: Optional[UUID] = Field(
|
163
154
|
title="The service connector linked to this stack component.",
|
164
155
|
default=None,
|
@@ -201,10 +192,6 @@ class ComponentResponseMetadata(WorkspaceScopedResponseMetadata):
|
|
201
192
|
default=None,
|
202
193
|
title="The stack component labels.",
|
203
194
|
)
|
204
|
-
component_spec_path: Optional[str] = Field(
|
205
|
-
default=None,
|
206
|
-
title="The path to the component spec used for mlstacks deployments.",
|
207
|
-
)
|
208
195
|
connector_resource_id: Optional[str] = Field(
|
209
196
|
default=None,
|
210
197
|
description="The ID of a specific resource instance to "
|
@@ -325,15 +312,6 @@ class ComponentResponse(
|
|
325
312
|
"""
|
326
313
|
return self.get_metadata().labels
|
327
314
|
|
328
|
-
@property
|
329
|
-
def component_spec_path(self) -> Optional[str]:
|
330
|
-
"""The `component_spec_path` property.
|
331
|
-
|
332
|
-
Returns:
|
333
|
-
the value of the property.
|
334
|
-
"""
|
335
|
-
return self.get_metadata().component_spec_path
|
336
|
-
|
337
315
|
@property
|
338
316
|
def connector_resource_id(self) -> Optional[str]:
|
339
317
|
"""The `connector_resource_id` property.
|
@@ -652,6 +652,7 @@ class ModelVersionFilter(WorkspaceScopedTaggableFilter):
|
|
652
652
|
|
653
653
|
from zenml.zen_stores.schemas import (
|
654
654
|
ModelVersionSchema,
|
655
|
+
RunMetadataResourceSchema,
|
655
656
|
RunMetadataSchema,
|
656
657
|
UserSchema,
|
657
658
|
)
|
@@ -672,10 +673,12 @@ class ModelVersionFilter(WorkspaceScopedTaggableFilter):
|
|
672
673
|
|
673
674
|
for key, value in self.run_metadata.items():
|
674
675
|
additional_filter = and_(
|
675
|
-
|
676
|
-
|
676
|
+
RunMetadataResourceSchema.resource_id
|
677
|
+
== ModelVersionSchema.id,
|
678
|
+
RunMetadataResourceSchema.resource_type
|
677
679
|
== MetadataResourceTypes.MODEL_VERSION,
|
678
|
-
|
680
|
+
RunMetadataResourceSchema.run_metadata_id
|
681
|
+
== RunMetadataSchema.id,
|
679
682
|
self.generate_custom_query_conditions_for_column(
|
680
683
|
value=value,
|
681
684
|
table=RunMetadataSchema,
|
@@ -237,7 +237,7 @@ class PipelineRunResponseMetadata(WorkspaceScopedResponseMetadata):
|
|
237
237
|
default=False,
|
238
238
|
description="Whether a template can be created from this run.",
|
239
239
|
)
|
240
|
-
|
240
|
+
step_substitutions: Dict[str, Dict[str, str]] = Field(
|
241
241
|
title="Substitutions used in the step runs of this pipeline run.",
|
242
242
|
default_factory=dict,
|
243
243
|
)
|
@@ -550,6 +550,15 @@ class PipelineRunResponse(
|
|
550
550
|
"""
|
551
551
|
return self.get_metadata().is_templatable
|
552
552
|
|
553
|
+
@property
|
554
|
+
def step_substitutions(self) -> Dict[str, Dict[str, str]]:
|
555
|
+
"""The `step_substitutions` property.
|
556
|
+
|
557
|
+
Returns:
|
558
|
+
the value of the property.
|
559
|
+
"""
|
560
|
+
return self.get_metadata().step_substitutions
|
561
|
+
|
553
562
|
@property
|
554
563
|
def model_version(self) -> Optional[ModelVersionResponse]:
|
555
564
|
"""The `model_version` property.
|
@@ -726,6 +735,7 @@ class PipelineRunFilter(WorkspaceScopedTaggableFilter):
|
|
726
735
|
PipelineDeploymentSchema,
|
727
736
|
PipelineRunSchema,
|
728
737
|
PipelineSchema,
|
738
|
+
RunMetadataResourceSchema,
|
729
739
|
RunMetadataSchema,
|
730
740
|
ScheduleSchema,
|
731
741
|
StackComponentSchema,
|
@@ -901,10 +911,12 @@ class PipelineRunFilter(WorkspaceScopedTaggableFilter):
|
|
901
911
|
|
902
912
|
for key, value in self.run_metadata.items():
|
903
913
|
additional_filter = and_(
|
904
|
-
|
905
|
-
|
914
|
+
RunMetadataResourceSchema.resource_id
|
915
|
+
== PipelineRunSchema.id,
|
916
|
+
RunMetadataResourceSchema.resource_type
|
906
917
|
== MetadataResourceTypes.PIPELINE_RUN,
|
907
|
-
|
918
|
+
RunMetadataResourceSchema.run_metadata_id
|
919
|
+
== RunMetadataSchema.id,
|
908
920
|
self.generate_custom_query_conditions_for_column(
|
909
921
|
value=value,
|
910
922
|
table=RunMetadataSchema,
|