zenml-nightly 0.58.2.dev20240618__py3-none-any.whl → 0.58.2.dev20240619__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/_hub/client.py +8 -5
- zenml/actions/base_action.py +8 -10
- zenml/artifact_stores/base_artifact_store.py +20 -15
- zenml/artifact_stores/local_artifact_store.py +3 -2
- zenml/artifacts/artifact_config.py +34 -19
- zenml/artifacts/external_artifact.py +18 -8
- zenml/artifacts/external_artifact_config.py +14 -6
- zenml/artifacts/unmaterialized_artifact.py +2 -11
- zenml/cli/__init__.py +6 -0
- zenml/cli/artifact.py +20 -2
- zenml/cli/served_model.py +0 -1
- zenml/cli/server.py +3 -3
- zenml/cli/utils.py +36 -40
- zenml/cli/web_login.py +2 -2
- zenml/client.py +198 -24
- zenml/client_lazy_loader.py +20 -14
- zenml/config/base_settings.py +5 -6
- zenml/config/build_configuration.py +1 -1
- zenml/config/compiler.py +3 -3
- zenml/config/docker_settings.py +27 -28
- zenml/config/global_config.py +33 -37
- zenml/config/pipeline_configurations.py +8 -11
- zenml/config/pipeline_run_configuration.py +6 -2
- zenml/config/pipeline_spec.py +3 -4
- zenml/config/resource_settings.py +8 -9
- zenml/config/schedule.py +16 -20
- zenml/config/secret_reference_mixin.py +6 -3
- zenml/config/secrets_store_config.py +16 -23
- zenml/config/server_config.py +50 -46
- zenml/config/settings_resolver.py +1 -1
- zenml/config/source.py +45 -35
- zenml/config/step_configurations.py +53 -31
- zenml/config/store_config.py +20 -19
- zenml/config/strict_base_model.py +2 -6
- zenml/constants.py +26 -2
- zenml/container_registries/base_container_registry.py +3 -2
- zenml/container_registries/default_container_registry.py +3 -3
- zenml/event_hub/base_event_hub.py +1 -1
- zenml/event_sources/base_event_source.py +11 -16
- zenml/exceptions.py +4 -0
- zenml/integrations/airflow/__init__.py +2 -10
- zenml/integrations/airflow/flavors/airflow_orchestrator_flavor.py +6 -7
- zenml/integrations/airflow/orchestrators/airflow_orchestrator.py +13 -249
- zenml/integrations/airflow/orchestrators/dag_generator.py +5 -3
- zenml/integrations/argilla/flavors/argilla_annotator_flavor.py +5 -4
- zenml/integrations/aws/__init__.py +1 -1
- zenml/integrations/aws/flavors/aws_container_registry_flavor.py +3 -2
- zenml/integrations/aws/flavors/sagemaker_orchestrator_flavor.py +11 -5
- zenml/integrations/aws/flavors/sagemaker_step_operator_flavor.py +6 -2
- zenml/integrations/aws/service_connectors/aws_service_connector.py +5 -4
- zenml/integrations/azure/flavors/azureml_step_operator_flavor.py +4 -4
- zenml/integrations/azure/service_connectors/azure_service_connector.py +4 -3
- zenml/integrations/azure/step_operators/azureml_step_operator.py +1 -1
- zenml/integrations/bentoml/steps/bentoml_deployer.py +1 -1
- zenml/integrations/bitbucket/plugins/event_sources/bitbucket_webhook_event_source.py +8 -12
- zenml/integrations/comet/flavors/comet_experiment_tracker_flavor.py +1 -1
- zenml/integrations/evidently/__init__.py +3 -4
- zenml/integrations/evidently/column_mapping.py +11 -3
- zenml/integrations/evidently/data_validators/evidently_data_validator.py +21 -3
- zenml/integrations/evidently/metrics.py +5 -6
- zenml/integrations/evidently/tests.py +5 -6
- zenml/integrations/facets/models.py +2 -6
- zenml/integrations/feast/__init__.py +3 -1
- zenml/integrations/feast/feature_stores/feast_feature_store.py +0 -23
- zenml/integrations/gcp/__init__.py +1 -1
- zenml/integrations/gcp/flavors/vertex_orchestrator_flavor.py +1 -1
- zenml/integrations/gcp/flavors/vertex_step_operator_flavor.py +1 -1
- zenml/integrations/gcp/orchestrators/vertex_orchestrator.py +234 -103
- zenml/integrations/gcp/service_connectors/gcp_service_connector.py +57 -42
- zenml/integrations/github/code_repositories/github_code_repository.py +1 -1
- zenml/integrations/github/plugins/event_sources/github_webhook_event_source.py +9 -13
- zenml/integrations/great_expectations/__init__.py +1 -1
- zenml/integrations/great_expectations/data_validators/ge_data_validator.py +44 -44
- zenml/integrations/great_expectations/flavors/great_expectations_data_validator_flavor.py +35 -2
- zenml/integrations/great_expectations/ge_store_backend.py +24 -11
- zenml/integrations/great_expectations/materializers/ge_materializer.py +3 -3
- zenml/integrations/great_expectations/utils.py +5 -5
- zenml/integrations/huggingface/__init__.py +3 -0
- zenml/integrations/huggingface/flavors/huggingface_model_deployer_flavor.py +1 -1
- zenml/integrations/huggingface/steps/__init__.py +3 -0
- zenml/integrations/huggingface/steps/accelerate_runner.py +149 -0
- zenml/integrations/huggingface/steps/huggingface_deployer.py +2 -2
- zenml/integrations/hyperai/flavors/hyperai_orchestrator_flavor.py +1 -1
- zenml/integrations/hyperai/service_connectors/hyperai_service_connector.py +4 -3
- zenml/integrations/kubeflow/__init__.py +1 -1
- zenml/integrations/kubeflow/flavors/kubeflow_orchestrator_flavor.py +48 -81
- zenml/integrations/kubeflow/orchestrators/kubeflow_orchestrator.py +295 -245
- zenml/integrations/kubernetes/flavors/kubernetes_orchestrator_flavor.py +1 -1
- zenml/integrations/kubernetes/orchestrators/kubernetes_orchestrator_entrypoint.py +11 -2
- zenml/integrations/kubernetes/pod_settings.py +17 -31
- zenml/integrations/kubernetes/service_connectors/kubernetes_service_connector.py +8 -7
- zenml/integrations/label_studio/__init__.py +1 -3
- zenml/integrations/label_studio/annotators/label_studio_annotator.py +3 -4
- zenml/integrations/label_studio/flavors/label_studio_annotator_flavor.py +2 -2
- zenml/integrations/langchain/materializers/document_materializer.py +44 -8
- zenml/integrations/mlflow/__init__.py +9 -3
- zenml/integrations/mlflow/experiment_trackers/mlflow_experiment_tracker.py +1 -1
- zenml/integrations/mlflow/flavors/mlflow_experiment_tracker_flavor.py +29 -37
- zenml/integrations/mlflow/model_registries/mlflow_model_registry.py +4 -4
- zenml/integrations/mlflow/steps/mlflow_deployer.py +1 -1
- zenml/integrations/neptune/flavors/neptune_experiment_tracker_flavor.py +1 -1
- zenml/integrations/pigeon/flavors/pigeon_annotator_flavor.py +1 -1
- zenml/integrations/s3/flavors/s3_artifact_store_flavor.py +9 -8
- zenml/integrations/seldon/seldon_client.py +52 -67
- zenml/integrations/seldon/services/seldon_deployment.py +3 -3
- zenml/integrations/seldon/steps/seldon_deployer.py +4 -4
- zenml/integrations/skypilot/flavors/skypilot_orchestrator_base_vm_config.py +15 -5
- zenml/integrations/skypilot_aws/__init__.py +1 -1
- zenml/integrations/skypilot_aws/flavors/skypilot_orchestrator_aws_vm_flavor.py +1 -1
- zenml/integrations/skypilot_azure/__init__.py +1 -1
- zenml/integrations/skypilot_azure/flavors/skypilot_orchestrator_azure_vm_flavor.py +1 -1
- zenml/integrations/skypilot_gcp/__init__.py +2 -1
- zenml/integrations/skypilot_gcp/flavors/skypilot_orchestrator_gcp_vm_flavor.py +1 -1
- zenml/integrations/skypilot_lambda/flavors/skypilot_orchestrator_lambda_vm_flavor.py +2 -2
- zenml/integrations/spark/flavors/spark_step_operator_flavor.py +1 -1
- zenml/integrations/tekton/__init__.py +1 -1
- zenml/integrations/tekton/flavors/tekton_orchestrator_flavor.py +66 -23
- zenml/integrations/tekton/orchestrators/tekton_orchestrator.py +547 -233
- zenml/integrations/tensorboard/__init__.py +1 -12
- zenml/integrations/tensorboard/services/tensorboard_service.py +3 -5
- zenml/integrations/tensorboard/visualizers/tensorboard_visualizer.py +6 -6
- zenml/integrations/tensorflow/__init__.py +2 -10
- zenml/integrations/tensorflow/materializers/keras_materializer.py +17 -9
- zenml/integrations/wandb/flavors/wandb_experiment_tracker_flavor.py +9 -14
- zenml/integrations/whylogs/flavors/whylogs_data_validator_flavor.py +1 -1
- zenml/lineage_graph/lineage_graph.py +1 -1
- zenml/materializers/built_in_materializer.py +3 -3
- zenml/materializers/pydantic_materializer.py +2 -2
- zenml/metadata/lazy_load.py +4 -4
- zenml/metadata/metadata_types.py +64 -4
- zenml/model/model.py +79 -54
- zenml/model_deployers/base_model_deployer.py +14 -12
- zenml/model_registries/base_model_registry.py +17 -15
- zenml/models/__init__.py +79 -206
- zenml/models/v2/base/base.py +54 -41
- zenml/models/v2/base/base_plugin_flavor.py +2 -6
- zenml/models/v2/base/filter.py +91 -76
- zenml/models/v2/base/page.py +2 -12
- zenml/models/v2/base/scoped.py +4 -7
- zenml/models/v2/core/api_key.py +22 -8
- zenml/models/v2/core/artifact.py +2 -2
- zenml/models/v2/core/artifact_version.py +74 -40
- zenml/models/v2/core/code_repository.py +37 -10
- zenml/models/v2/core/component.py +65 -16
- zenml/models/v2/core/device.py +14 -4
- zenml/models/v2/core/event_source.py +1 -2
- zenml/models/v2/core/flavor.py +74 -8
- zenml/models/v2/core/logs.py +68 -8
- zenml/models/v2/core/model.py +8 -4
- zenml/models/v2/core/model_version.py +25 -6
- zenml/models/v2/core/model_version_artifact.py +51 -21
- zenml/models/v2/core/model_version_pipeline_run.py +45 -13
- zenml/models/v2/core/pipeline.py +37 -72
- zenml/models/v2/core/pipeline_build.py +29 -17
- zenml/models/v2/core/pipeline_deployment.py +18 -6
- zenml/models/v2/core/pipeline_namespace.py +113 -0
- zenml/models/v2/core/pipeline_run.py +50 -22
- zenml/models/v2/core/run_metadata.py +59 -36
- zenml/models/v2/core/schedule.py +37 -24
- zenml/models/v2/core/secret.py +31 -12
- zenml/models/v2/core/service.py +64 -36
- zenml/models/v2/core/service_account.py +24 -11
- zenml/models/v2/core/service_connector.py +219 -44
- zenml/models/v2/core/stack.py +45 -17
- zenml/models/v2/core/step_run.py +28 -8
- zenml/models/v2/core/tag.py +8 -4
- zenml/models/v2/core/trigger.py +2 -2
- zenml/models/v2/core/trigger_execution.py +1 -0
- zenml/models/v2/core/user.py +18 -21
- zenml/models/v2/core/workspace.py +13 -3
- zenml/models/v2/misc/build_item.py +3 -3
- zenml/models/v2/misc/external_user.py +2 -6
- zenml/models/v2/misc/hub_plugin_models.py +9 -9
- zenml/models/v2/misc/loaded_visualization.py +2 -2
- zenml/models/v2/misc/service_connector_type.py +8 -17
- zenml/models/v2/misc/user_auth.py +7 -2
- zenml/new/pipelines/build_utils.py +3 -3
- zenml/new/pipelines/pipeline.py +17 -13
- zenml/new/pipelines/run_utils.py +103 -1
- zenml/orchestrators/base_orchestrator.py +10 -7
- zenml/orchestrators/local_docker/local_docker_orchestrator.py +1 -1
- zenml/orchestrators/step_runner.py +3 -6
- zenml/orchestrators/utils.py +1 -1
- zenml/plugins/base_plugin_flavor.py +6 -10
- zenml/plugins/plugin_flavor_registry.py +3 -7
- zenml/secret/base_secret.py +7 -8
- zenml/service_connectors/docker_service_connector.py +4 -3
- zenml/service_connectors/service_connector.py +5 -12
- zenml/service_connectors/service_connector_registry.py +2 -4
- zenml/services/container/container_service.py +1 -1
- zenml/services/container/container_service_endpoint.py +1 -1
- zenml/services/local/local_service.py +1 -1
- zenml/services/local/local_service_endpoint.py +1 -1
- zenml/services/service.py +16 -10
- zenml/services/service_type.py +4 -5
- zenml/services/terraform/terraform_service.py +1 -1
- zenml/stack/flavor.py +1 -5
- zenml/stack/flavor_registry.py +4 -4
- zenml/stack/stack.py +4 -1
- zenml/stack/stack_component.py +55 -31
- zenml/steps/base_step.py +34 -28
- zenml/steps/entrypoint_function_utils.py +3 -5
- zenml/steps/utils.py +12 -14
- zenml/utils/cuda_utils.py +50 -0
- zenml/utils/deprecation_utils.py +18 -20
- zenml/utils/dict_utils.py +1 -1
- zenml/utils/filesync_model.py +65 -28
- zenml/utils/function_utils.py +260 -0
- zenml/utils/json_utils.py +131 -0
- zenml/utils/mlstacks_utils.py +2 -2
- zenml/utils/pydantic_utils.py +270 -62
- zenml/utils/secret_utils.py +65 -12
- zenml/utils/source_utils.py +2 -2
- zenml/utils/typed_model.py +5 -3
- zenml/utils/typing_utils.py +243 -0
- zenml/utils/yaml_utils.py +1 -1
- zenml/zen_server/auth.py +2 -2
- zenml/zen_server/cloud_utils.py +6 -6
- zenml/zen_server/deploy/base_provider.py +1 -1
- zenml/zen_server/deploy/deployment.py +6 -8
- zenml/zen_server/deploy/docker/docker_zen_server.py +3 -4
- zenml/zen_server/deploy/local/local_provider.py +0 -1
- zenml/zen_server/deploy/local/local_zen_server.py +6 -6
- zenml/zen_server/deploy/terraform/terraform_zen_server.py +4 -6
- zenml/zen_server/exceptions.py +4 -1
- zenml/zen_server/feature_gate/zenml_cloud_feature_gate.py +1 -1
- zenml/zen_server/pipeline_deployment/utils.py +48 -68
- zenml/zen_server/rbac/models.py +2 -5
- zenml/zen_server/rbac/utils.py +11 -14
- zenml/zen_server/routers/auth_endpoints.py +2 -2
- zenml/zen_server/routers/pipeline_builds_endpoints.py +1 -1
- zenml/zen_server/routers/runs_endpoints.py +1 -1
- zenml/zen_server/routers/secrets_endpoints.py +3 -2
- zenml/zen_server/routers/server_endpoints.py +1 -1
- zenml/zen_server/routers/steps_endpoints.py +1 -1
- zenml/zen_server/routers/workspaces_endpoints.py +1 -1
- zenml/zen_stores/base_zen_store.py +46 -9
- zenml/zen_stores/migrations/utils.py +42 -46
- zenml/zen_stores/migrations/versions/0701da9951a0_added_service_table.py +1 -1
- zenml/zen_stores/migrations/versions/1041bc644e0d_remove_secrets_manager.py +5 -3
- zenml/zen_stores/migrations/versions/10a907dad202_delete_mlmd_tables.py +1 -1
- zenml/zen_stores/migrations/versions/26b776ad583e_redesign_artifacts.py +8 -10
- zenml/zen_stores/migrations/versions/37835ce041d2_optimizing_database.py +3 -3
- zenml/zen_stores/migrations/versions/46506f72f0ed_add_server_settings.py +10 -12
- zenml/zen_stores/migrations/versions/5994f9ad0489_introduce_role_permissions.py +3 -2
- zenml/zen_stores/migrations/versions/6917bce75069_add_pipeline_run_unique_constraint.py +4 -4
- zenml/zen_stores/migrations/versions/728c6369cfaa_add_name_column_to_input_artifact_pk.py +3 -2
- zenml/zen_stores/migrations/versions/743ec82b1b3c_update_size_of_build_images.py +2 -2
- zenml/zen_stores/migrations/versions/7500f434b71c_remove_shared_columns.py +3 -2
- zenml/zen_stores/migrations/versions/7834208cc3f6_artifact_project_scoping.py +8 -7
- zenml/zen_stores/migrations/versions/7b651bf6822e_track_secrets_in_db.py +6 -4
- zenml/zen_stores/migrations/versions/7e4a481d17f7_add_identity_table.py +2 -2
- zenml/zen_stores/migrations/versions/7f603e583dd7_fixed_migration.py +1 -1
- zenml/zen_stores/migrations/versions/a39c4184c8ce_remove_secrets_manager_flavors.py +2 -2
- zenml/zen_stores/migrations/versions/a91762e6be36_artifact_version_table.py +4 -4
- zenml/zen_stores/migrations/versions/alembic_start.py +1 -1
- zenml/zen_stores/migrations/versions/fbd7f18ced1e_increase_step_run_field_lengths.py +4 -4
- zenml/zen_stores/rest_zen_store.py +109 -49
- zenml/zen_stores/schemas/api_key_schemas.py +1 -1
- zenml/zen_stores/schemas/artifact_schemas.py +8 -8
- zenml/zen_stores/schemas/artifact_visualization_schemas.py +3 -3
- zenml/zen_stores/schemas/code_repository_schemas.py +1 -1
- zenml/zen_stores/schemas/component_schemas.py +8 -3
- zenml/zen_stores/schemas/device_schemas.py +8 -6
- zenml/zen_stores/schemas/event_source_schemas.py +3 -4
- zenml/zen_stores/schemas/flavor_schemas.py +5 -3
- zenml/zen_stores/schemas/model_schemas.py +26 -1
- zenml/zen_stores/schemas/pipeline_build_schemas.py +1 -1
- zenml/zen_stores/schemas/pipeline_deployment_schemas.py +4 -4
- zenml/zen_stores/schemas/pipeline_run_schemas.py +6 -6
- zenml/zen_stores/schemas/pipeline_schemas.py +5 -2
- zenml/zen_stores/schemas/run_metadata_schemas.py +2 -2
- zenml/zen_stores/schemas/secret_schemas.py +8 -5
- zenml/zen_stores/schemas/server_settings_schemas.py +3 -1
- zenml/zen_stores/schemas/service_connector_schemas.py +1 -1
- zenml/zen_stores/schemas/service_schemas.py +11 -2
- zenml/zen_stores/schemas/stack_schemas.py +1 -1
- zenml/zen_stores/schemas/step_run_schemas.py +11 -11
- zenml/zen_stores/schemas/tag_schemas.py +6 -2
- zenml/zen_stores/schemas/trigger_schemas.py +2 -2
- zenml/zen_stores/schemas/user_schemas.py +2 -2
- zenml/zen_stores/schemas/workspace_schemas.py +3 -1
- zenml/zen_stores/secrets_stores/aws_secrets_store.py +19 -20
- zenml/zen_stores/secrets_stores/azure_secrets_store.py +17 -20
- zenml/zen_stores/secrets_stores/base_secrets_store.py +79 -12
- zenml/zen_stores/secrets_stores/gcp_secrets_store.py +17 -20
- zenml/zen_stores/secrets_stores/hashicorp_secrets_store.py +4 -8
- zenml/zen_stores/secrets_stores/service_connector_secrets_store.py +10 -7
- zenml/zen_stores/secrets_stores/sql_secrets_store.py +5 -6
- zenml/zen_stores/sql_zen_store.py +196 -120
- zenml/zen_stores/zen_store_interface.py +33 -0
- {zenml_nightly-0.58.2.dev20240618.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/METADATA +8 -7
- {zenml_nightly-0.58.2.dev20240618.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/RECORD +297 -294
- zenml/integrations/kubeflow/utils.py +0 -95
- zenml/models/v2/base/internal.py +0 -37
- zenml/models/v2/base/update.py +0 -44
- {zenml_nightly-0.58.2.dev20240618.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/LICENSE +0 -0
- {zenml_nightly-0.58.2.dev20240618.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/WHEEL +0 -0
- {zenml_nightly-0.58.2.dev20240618.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/entry_points.txt +0 -0
@@ -100,15 +100,16 @@ def resolve_duplicate_names() -> None:
|
|
100
100
|
"""Resolve duplicate names for shareable entities."""
|
101
101
|
connection = op.get_bind()
|
102
102
|
|
103
|
-
meta = sa.MetaData(
|
103
|
+
meta = sa.MetaData()
|
104
104
|
meta.reflect(
|
105
|
+
bind=op.get_bind(),
|
105
106
|
only=(
|
106
107
|
"stack",
|
107
108
|
"stack_component",
|
108
109
|
"stack_composition",
|
109
110
|
"service_connector",
|
110
111
|
"workspace",
|
111
|
-
)
|
112
|
+
),
|
112
113
|
)
|
113
114
|
|
114
115
|
stack_table = sa.Table("stack", meta)
|
@@ -49,15 +49,16 @@ def upgrade() -> None:
|
|
49
49
|
# ------------
|
50
50
|
|
51
51
|
conn = op.get_bind()
|
52
|
-
meta = sa.MetaData(
|
52
|
+
meta = sa.MetaData()
|
53
53
|
meta.reflect(
|
54
|
+
bind=op.get_bind(),
|
54
55
|
only=(
|
55
56
|
"pipeline_run",
|
56
57
|
"step_run",
|
57
58
|
"artifact",
|
58
59
|
"step_run_output_artifact",
|
59
60
|
"workspace",
|
60
|
-
)
|
61
|
+
),
|
61
62
|
)
|
62
63
|
pipeline_runs = sa.Table("pipeline_run", meta)
|
63
64
|
step_runs = sa.Table("step_run", meta)
|
@@ -67,12 +68,12 @@ def upgrade() -> None:
|
|
67
68
|
|
68
69
|
# Use the first workspace as the default workspace in case an artifact or
|
69
70
|
# step run has no associated pipeline run or producer step run.
|
70
|
-
default_workspace = conn.execute(select(
|
71
|
+
default_workspace = conn.execute(select(workspace)).first()
|
71
72
|
|
72
73
|
# For each step run, set user and project according to its pipeline run
|
73
|
-
for step_run in conn.execute(select(
|
74
|
+
for step_run in conn.execute(select(step_runs)).all():
|
74
75
|
pipeline_run = conn.execute(
|
75
|
-
select(
|
76
|
+
select(pipeline_runs).where(
|
76
77
|
pipeline_runs.c.id == step_run.pipeline_run_id
|
77
78
|
)
|
78
79
|
).first()
|
@@ -90,9 +91,9 @@ def upgrade() -> None:
|
|
90
91
|
)
|
91
92
|
|
92
93
|
# For each artifact, set user and project according to its producer step run
|
93
|
-
for artifact in conn.execute(select(
|
94
|
+
for artifact in conn.execute(select(artifacts)).all():
|
94
95
|
producer_step_run = conn.execute(
|
95
|
-
select(
|
96
|
+
select(step_runs)
|
96
97
|
.where(step_runs.c.status == "completed")
|
97
98
|
.where(step_runs.c.id == step_run_output_artifacts.c.step_id)
|
98
99
|
.where(step_run_output_artifacts.c.artifact_id == artifact.id)
|
@@ -58,7 +58,7 @@ class BaseSecretsStoreBackend(BaseModel):
|
|
58
58
|
"""Base class for accessing and listing ZenML secrets."""
|
59
59
|
|
60
60
|
server_id: UUID
|
61
|
-
client: Any
|
61
|
+
client: Any = None
|
62
62
|
|
63
63
|
def _get_secret_metadata(
|
64
64
|
self,
|
@@ -603,15 +603,17 @@ def upgrade() -> None:
|
|
603
603
|
# Transfer secrets from the external secrets store to the db
|
604
604
|
|
605
605
|
conn = op.get_bind()
|
606
|
-
meta = sa.MetaData(
|
607
|
-
meta.reflect(
|
606
|
+
meta = sa.MetaData()
|
607
|
+
meta.reflect(
|
608
|
+
only=("secret", "user", "workspace", "identity"), bind=op.get_bind()
|
609
|
+
)
|
608
610
|
secrets = sa.Table("secret", meta)
|
609
611
|
users = sa.Table("user", meta)
|
610
612
|
workspaces = sa.Table("workspace", meta)
|
611
613
|
identity = sa.Table("identity", meta)
|
612
614
|
|
613
615
|
# Extract the ZenML deployment ID from the identity table
|
614
|
-
server_id = UUID(conn.execute(
|
616
|
+
server_id = UUID(conn.execute(sa.select(identity.c.id)).scalar_one())
|
615
617
|
|
616
618
|
# Initialize the secrets store backend based on the backend client extracted
|
617
619
|
# from the secrets store.
|
@@ -27,11 +27,11 @@ def upgrade() -> None:
|
|
27
27
|
sa.PrimaryKeyConstraint("id"),
|
28
28
|
)
|
29
29
|
# get metadata from current connection
|
30
|
-
meta = sa.MetaData(
|
30
|
+
meta = sa.MetaData()
|
31
31
|
|
32
32
|
# pass in tuple with tables we want to reflect, otherwise whole database
|
33
33
|
# will get reflected
|
34
|
-
meta.reflect(only=("identity",))
|
34
|
+
meta.reflect(only=("identity",), bind=op.get_bind())
|
35
35
|
# Prefill the identity table with a single row that contains the deployment
|
36
36
|
# id extracted from the global configuration
|
37
37
|
op.bulk_insert(
|
@@ -19,8 +19,8 @@ depends_on = None
|
|
19
19
|
def upgrade() -> None:
|
20
20
|
"""Upgrade database schema and/or data, creating a new revision."""
|
21
21
|
conn = op.get_bind()
|
22
|
-
meta = sa.MetaData(
|
23
|
-
meta.reflect(only=("flavor",))
|
22
|
+
meta = sa.MetaData()
|
23
|
+
meta.reflect(only=("flavor",), bind=op.get_bind())
|
24
24
|
flavors = sa.Table("flavor", meta)
|
25
25
|
|
26
26
|
# Remove all secrets manager flavors
|
@@ -46,13 +46,13 @@ def upgrade() -> None:
|
|
46
46
|
|
47
47
|
# Find all unique artifact names and create a new artifact entry for each
|
48
48
|
conn = op.get_bind()
|
49
|
-
meta = sa.MetaData(
|
50
|
-
meta.reflect(only=("artifact", "artifact_version"))
|
49
|
+
meta = sa.MetaData()
|
50
|
+
meta.reflect(only=("artifact", "artifact_version"), bind=op.get_bind())
|
51
51
|
artifacts = sa.Table("artifact", meta)
|
52
52
|
artifact_versions = sa.Table("artifact_version", meta)
|
53
53
|
artifact_names = conn.execute(
|
54
54
|
sa.select(
|
55
|
-
|
55
|
+
artifact_versions.c.name, artifact_versions.c.has_custom_name
|
56
56
|
).distinct()
|
57
57
|
).all()
|
58
58
|
unique_artifact_names = {
|
@@ -72,7 +72,7 @@ def upgrade() -> None:
|
|
72
72
|
# Set artifact_id column in artifact_version
|
73
73
|
conn.execute(
|
74
74
|
artifact_versions.update().values(
|
75
|
-
artifact_id=sa.select(
|
75
|
+
artifact_id=sa.select(artifacts.c.id)
|
76
76
|
.where(artifacts.c.name == artifact_versions.c.name)
|
77
77
|
.scalar_subquery()
|
78
78
|
)
|
@@ -22,7 +22,7 @@ def upgrade() -> None:
|
|
22
22
|
"""Upgrade database schema and/or data, creating a new revision."""
|
23
23
|
# If the tables already exist, skip this migration.
|
24
24
|
conn = op.get_bind()
|
25
|
-
inspector = Inspector.from_engine(conn)
|
25
|
+
inspector = Inspector.from_engine(conn.engine)
|
26
26
|
tables = inspector.get_table_names()
|
27
27
|
if "projectschema" in tables:
|
28
28
|
return
|
@@ -25,7 +25,7 @@ def upgrade() -> None:
|
|
25
25
|
"parameters",
|
26
26
|
existing_type=sa.TEXT(),
|
27
27
|
type_=sa.String(length=16777215).with_variant(
|
28
|
-
mysql.MEDIUMTEXT
|
28
|
+
mysql.MEDIUMTEXT, "mysql"
|
29
29
|
),
|
30
30
|
existing_nullable=False,
|
31
31
|
)
|
@@ -33,7 +33,7 @@ def upgrade() -> None:
|
|
33
33
|
"step_configuration",
|
34
34
|
existing_type=sa.TEXT(),
|
35
35
|
type_=sa.String(length=16777215).with_variant(
|
36
|
-
mysql.MEDIUMTEXT
|
36
|
+
mysql.MEDIUMTEXT, "mysql"
|
37
37
|
),
|
38
38
|
existing_nullable=False,
|
39
39
|
)
|
@@ -48,7 +48,7 @@ def downgrade() -> None:
|
|
48
48
|
batch_op.alter_column(
|
49
49
|
"step_configuration",
|
50
50
|
existing_type=sa.String(length=16777215).with_variant(
|
51
|
-
mysql.MEDIUMTEXT
|
51
|
+
mysql.MEDIUMTEXT, "mysql"
|
52
52
|
),
|
53
53
|
type_=sa.TEXT(),
|
54
54
|
existing_nullable=False,
|
@@ -56,7 +56,7 @@ def downgrade() -> None:
|
|
56
56
|
batch_op.alter_column(
|
57
57
|
"parameters",
|
58
58
|
existing_type=sa.String(length=16777215).with_variant(
|
59
|
-
mysql.MEDIUMTEXT
|
59
|
+
mysql.MEDIUMTEXT, "mysql"
|
60
60
|
),
|
61
61
|
type_=sa.TEXT(),
|
62
62
|
existing_nullable=False,
|
@@ -32,12 +32,19 @@ from uuid import UUID
|
|
32
32
|
|
33
33
|
import requests
|
34
34
|
import urllib3
|
35
|
-
from pydantic import
|
35
|
+
from pydantic import (
|
36
|
+
BaseModel,
|
37
|
+
ConfigDict,
|
38
|
+
Field,
|
39
|
+
field_validator,
|
40
|
+
model_validator,
|
41
|
+
)
|
36
42
|
from requests.adapters import HTTPAdapter, Retry
|
37
43
|
|
38
44
|
import zenml
|
39
45
|
from zenml.analytics import source_context
|
40
46
|
from zenml.config.global_config import GlobalConfiguration
|
47
|
+
from zenml.config.pipeline_run_configuration import PipelineRunConfiguration
|
41
48
|
from zenml.config.store_config import StoreConfiguration
|
42
49
|
from zenml.constants import (
|
43
50
|
API,
|
@@ -97,9 +104,7 @@ from zenml.enums import (
|
|
97
104
|
OAuthGrantTypes,
|
98
105
|
StoreType,
|
99
106
|
)
|
100
|
-
from zenml.exceptions import
|
101
|
-
AuthorizationException,
|
102
|
-
)
|
107
|
+
from zenml.exceptions import AuthorizationException, MethodNotAllowedError
|
103
108
|
from zenml.io import fileio
|
104
109
|
from zenml.logger import get_logger
|
105
110
|
from zenml.models import (
|
@@ -274,16 +279,13 @@ class RestZenStoreConfiguration(StoreConfiguration):
|
|
274
279
|
password: Optional[str] = None
|
275
280
|
api_key: Optional[str] = None
|
276
281
|
api_token: Optional[str] = None
|
277
|
-
verify_ssl: Union[bool, str] = True
|
282
|
+
verify_ssl: Union[bool, str] = Field(True, union_mode="left_to_right")
|
278
283
|
http_timeout: int = DEFAULT_HTTP_TIMEOUT
|
279
284
|
|
280
|
-
@
|
281
|
-
def validate_credentials(
|
285
|
+
@model_validator(mode="after")
|
286
|
+
def validate_credentials(self) -> "RestZenStoreConfiguration":
|
282
287
|
"""Validates the credentials provided in the values dictionary.
|
283
288
|
|
284
|
-
Args:
|
285
|
-
values: A dictionary containing the values to be validated.
|
286
|
-
|
287
289
|
Raises:
|
288
290
|
ValueError: If neither api_token nor username nor api_key is set.
|
289
291
|
|
@@ -292,18 +294,15 @@ class RestZenStoreConfiguration(StoreConfiguration):
|
|
292
294
|
"""
|
293
295
|
# Check if the values dictionary contains either an API token, an API
|
294
296
|
# key or a username as non-empty strings.
|
295
|
-
if
|
296
|
-
|
297
|
-
or values.get("username")
|
298
|
-
or values.get("api_key")
|
299
|
-
):
|
300
|
-
return values
|
297
|
+
if self.api_token or self.username or self.api_key:
|
298
|
+
return self
|
301
299
|
raise ValueError(
|
302
300
|
"Neither api_token nor username nor api_key is set in the "
|
303
301
|
"store config."
|
304
302
|
)
|
305
303
|
|
306
|
-
@
|
304
|
+
@field_validator("url")
|
305
|
+
@classmethod
|
307
306
|
def validate_url(cls, url: str) -> str:
|
308
307
|
"""Validates that the URL is a well-formed REST store URL.
|
309
308
|
|
@@ -331,7 +330,8 @@ class RestZenStoreConfiguration(StoreConfiguration):
|
|
331
330
|
|
332
331
|
return url
|
333
332
|
|
334
|
-
@
|
333
|
+
@field_validator("verify_ssl")
|
334
|
+
@classmethod
|
335
335
|
def validate_verify_ssl(
|
336
336
|
cls, verify_ssl: Union[bool, str]
|
337
337
|
) -> Union[bool, str]:
|
@@ -387,15 +387,14 @@ class RestZenStoreConfiguration(StoreConfiguration):
|
|
387
387
|
with open(self.verify_ssl, "r") as f:
|
388
388
|
self.verify_ssl = f.read()
|
389
389
|
|
390
|
-
|
391
|
-
"""Pydantic configuration class."""
|
392
|
-
|
390
|
+
model_config = ConfigDict(
|
393
391
|
# Don't validate attributes when assigning them. This is necessary
|
394
392
|
# because the `verify_ssl` attribute can be expanded to the contents
|
395
393
|
# of the certificate file.
|
396
|
-
validate_assignment
|
394
|
+
validate_assignment=False,
|
397
395
|
# Forbid extra attributes set in the class.
|
398
|
-
extra
|
396
|
+
extra="forbid",
|
397
|
+
)
|
399
398
|
|
400
399
|
|
401
400
|
class RestZenStore(BaseZenStore):
|
@@ -440,7 +439,7 @@ class RestZenStore(BaseZenStore):
|
|
440
439
|
Information about the server.
|
441
440
|
"""
|
442
441
|
body = self.get(INFO)
|
443
|
-
return ServerModel.
|
442
|
+
return ServerModel.model_validate(body)
|
444
443
|
|
445
444
|
def get_deployment_id(self) -> UUID:
|
446
445
|
"""Get the ID of the deployment.
|
@@ -465,7 +464,7 @@ class RestZenStore(BaseZenStore):
|
|
465
464
|
The server settings.
|
466
465
|
"""
|
467
466
|
response_body = self.get(SERVER_SETTINGS, params={"hydrate": hydrate})
|
468
|
-
return ServerSettingsResponse.
|
467
|
+
return ServerSettingsResponse.model_validate(response_body)
|
469
468
|
|
470
469
|
def update_server_settings(
|
471
470
|
self, settings_update: ServerSettingsUpdate
|
@@ -479,7 +478,7 @@ class RestZenStore(BaseZenStore):
|
|
479
478
|
The updated server settings.
|
480
479
|
"""
|
481
480
|
response_body = self.put(SERVER_SETTINGS, body=settings_update)
|
482
|
-
return ServerSettingsResponse.
|
481
|
+
return ServerSettingsResponse.model_validate(response_body)
|
483
482
|
|
484
483
|
# ----------------------------- API Keys -----------------------------
|
485
484
|
|
@@ -612,7 +611,7 @@ class RestZenStore(BaseZenStore):
|
|
612
611
|
f"{SERVICE_ACCOUNTS}/{str(service_account_id)}{API_KEYS}/{str(api_key_name_or_id)}{API_KEY_ROTATE}",
|
613
612
|
body=rotate_request,
|
614
613
|
)
|
615
|
-
return APIKeyResponse.
|
614
|
+
return APIKeyResponse.model_validate(response_body)
|
616
615
|
|
617
616
|
def delete_api_key(
|
618
617
|
self,
|
@@ -1415,9 +1414,34 @@ class RestZenStore(BaseZenStore):
|
|
1415
1414
|
route=PIPELINE_BUILDS,
|
1416
1415
|
)
|
1417
1416
|
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1417
|
+
def run_build(
|
1418
|
+
self,
|
1419
|
+
build_id: UUID,
|
1420
|
+
run_configuration: Optional[PipelineRunConfiguration] = None,
|
1421
|
+
) -> PipelineRunResponse:
|
1422
|
+
"""Run a pipeline from a build.
|
1423
|
+
|
1424
|
+
Args:
|
1425
|
+
build_id: The ID of the build to run.
|
1426
|
+
run_configuration: Configuration for the run.
|
1427
|
+
|
1428
|
+
Raises:
|
1429
|
+
RuntimeError: If the server does not support running a build.
|
1430
|
+
|
1431
|
+
Returns:
|
1432
|
+
Model of the pipeline run.
|
1433
|
+
"""
|
1434
|
+
run_configuration = run_configuration or PipelineRunConfiguration()
|
1435
|
+
try:
|
1436
|
+
response_body = self.post(
|
1437
|
+
f"{PIPELINE_BUILDS}/{build_id}/run", body=run_configuration
|
1438
|
+
)
|
1439
|
+
except MethodNotAllowedError as e:
|
1440
|
+
raise RuntimeError(
|
1441
|
+
"Running a build is not supported for this server."
|
1442
|
+
) from e
|
1443
|
+
|
1444
|
+
return PipelineRunResponse.parse_obj(response_body)
|
1421
1445
|
|
1422
1446
|
# -------------------------- Pipeline Deployments --------------------------
|
1423
1447
|
|
@@ -1493,6 +1517,37 @@ class RestZenStore(BaseZenStore):
|
|
1493
1517
|
route=PIPELINE_DEPLOYMENTS,
|
1494
1518
|
)
|
1495
1519
|
|
1520
|
+
def run_deployment(
|
1521
|
+
self,
|
1522
|
+
deployment_id: UUID,
|
1523
|
+
run_configuration: Optional[PipelineRunConfiguration] = None,
|
1524
|
+
) -> PipelineRunResponse:
|
1525
|
+
"""Run a pipeline from a deployment.
|
1526
|
+
|
1527
|
+
Args:
|
1528
|
+
deployment_id: The ID of the deployment to run.
|
1529
|
+
run_configuration: Configuration for the run.
|
1530
|
+
|
1531
|
+
Raises:
|
1532
|
+
RuntimeError: If the server does not support running a deployment.
|
1533
|
+
|
1534
|
+
Returns:
|
1535
|
+
Model of the pipeline run.
|
1536
|
+
"""
|
1537
|
+
run_configuration = run_configuration or PipelineRunConfiguration()
|
1538
|
+
|
1539
|
+
try:
|
1540
|
+
response_body = self.post(
|
1541
|
+
f"{PIPELINE_DEPLOYMENTS}/{deployment_id}/run",
|
1542
|
+
body=run_configuration,
|
1543
|
+
)
|
1544
|
+
except MethodNotAllowedError as e:
|
1545
|
+
raise RuntimeError(
|
1546
|
+
"Running a deployment is not supported for this server."
|
1547
|
+
) from e
|
1548
|
+
|
1549
|
+
return PipelineRunResponse.parse_obj(response_body)
|
1550
|
+
|
1496
1551
|
# -------------------- Event Sources --------------------
|
1497
1552
|
|
1498
1553
|
def create_event_source(
|
@@ -1721,7 +1776,7 @@ class RestZenStore(BaseZenStore):
|
|
1721
1776
|
result: List[RunMetadataResponse] = []
|
1722
1777
|
if isinstance(response_body, list):
|
1723
1778
|
for metadata in response_body or []:
|
1724
|
-
result.append(RunMetadataResponse.
|
1779
|
+
result.append(RunMetadataResponse.model_validate(metadata))
|
1725
1780
|
return result
|
1726
1781
|
|
1727
1782
|
def get_run_metadata(
|
@@ -2315,7 +2370,9 @@ class RestZenStore(BaseZenStore):
|
|
2315
2370
|
params={"list_resources": list_resources},
|
2316
2371
|
)
|
2317
2372
|
|
2318
|
-
resources = ServiceConnectorResourcesModel.
|
2373
|
+
resources = ServiceConnectorResourcesModel.model_validate(
|
2374
|
+
response_body
|
2375
|
+
)
|
2319
2376
|
self._populate_connector_type(resources)
|
2320
2377
|
return resources
|
2321
2378
|
|
@@ -2350,7 +2407,9 @@ class RestZenStore(BaseZenStore):
|
|
2350
2407
|
params=params,
|
2351
2408
|
)
|
2352
2409
|
|
2353
|
-
resources = ServiceConnectorResourcesModel.
|
2410
|
+
resources = ServiceConnectorResourcesModel.model_validate(
|
2411
|
+
response_body
|
2412
|
+
)
|
2354
2413
|
self._populate_connector_type(resources)
|
2355
2414
|
return resources
|
2356
2415
|
|
@@ -2381,7 +2440,7 @@ class RestZenStore(BaseZenStore):
|
|
2381
2440
|
params=params,
|
2382
2441
|
)
|
2383
2442
|
|
2384
|
-
connector = ServiceConnectorResponse.
|
2443
|
+
connector = ServiceConnectorResponse.model_validate(response_body)
|
2385
2444
|
self._populate_connector_type(connector)
|
2386
2445
|
return connector
|
2387
2446
|
|
@@ -2418,7 +2477,7 @@ class RestZenStore(BaseZenStore):
|
|
2418
2477
|
|
2419
2478
|
assert isinstance(response_body, list)
|
2420
2479
|
resource_list = [
|
2421
|
-
ServiceConnectorResourcesModel.
|
2480
|
+
ServiceConnectorResourcesModel.model_validate(item)
|
2422
2481
|
for item in response_body
|
2423
2482
|
]
|
2424
2483
|
|
@@ -2491,7 +2550,8 @@ class RestZenStore(BaseZenStore):
|
|
2491
2550
|
|
2492
2551
|
assert isinstance(response_body, list)
|
2493
2552
|
remote_connector_types = [
|
2494
|
-
ServiceConnectorTypeModel.
|
2553
|
+
ServiceConnectorTypeModel.model_validate(item)
|
2554
|
+
for item in response_body
|
2495
2555
|
]
|
2496
2556
|
|
2497
2557
|
# Mark the remote connector types as being only remotely available
|
@@ -2547,7 +2607,7 @@ class RestZenStore(BaseZenStore):
|
|
2547
2607
|
response_body = self.get(
|
2548
2608
|
f"{SERVICE_CONNECTOR_TYPES}/{connector_type}",
|
2549
2609
|
)
|
2550
|
-
remote_connector_type = ServiceConnectorTypeModel.
|
2610
|
+
remote_connector_type = ServiceConnectorTypeModel.model_validate(
|
2551
2611
|
response_body
|
2552
2612
|
)
|
2553
2613
|
if local_connector_type:
|
@@ -2935,7 +2995,7 @@ class RestZenStore(BaseZenStore):
|
|
2935
2995
|
)
|
2936
2996
|
else:
|
2937
2997
|
body = self.get(CURRENT_USER, params={"hydrate": hydrate})
|
2938
|
-
return UserResponse.
|
2998
|
+
return UserResponse.model_validate(body)
|
2939
2999
|
|
2940
3000
|
def list_users(
|
2941
3001
|
self,
|
@@ -2994,7 +3054,7 @@ class RestZenStore(BaseZenStore):
|
|
2994
3054
|
f"{USERS}/{str(user_name_or_id)}{DEACTIVATE}",
|
2995
3055
|
)
|
2996
3056
|
|
2997
|
-
return UserResponse.
|
3057
|
+
return UserResponse.model_validate(response_body)
|
2998
3058
|
|
2999
3059
|
def delete_user(self, user_name_or_id: Union[str, UUID]) -> None:
|
3000
3060
|
"""Deletes a user.
|
@@ -3924,7 +3984,7 @@ class RestZenStore(BaseZenStore):
|
|
3924
3984
|
return self._request(
|
3925
3985
|
"POST",
|
3926
3986
|
self.url + API + VERSION_1 + path,
|
3927
|
-
data=body.
|
3987
|
+
data=body.model_dump_json(),
|
3928
3988
|
params=params,
|
3929
3989
|
**kwargs,
|
3930
3990
|
)
|
@@ -3948,7 +4008,7 @@ class RestZenStore(BaseZenStore):
|
|
3948
4008
|
The response body.
|
3949
4009
|
"""
|
3950
4010
|
logger.debug(f"Sending PUT request to {path}...")
|
3951
|
-
data = body.
|
4011
|
+
data = body.model_dump_json(exclude_unset=True) if body else None
|
3952
4012
|
return self._request(
|
3953
4013
|
"PUT",
|
3954
4014
|
self.url + API + VERSION_1 + path,
|
@@ -3978,7 +4038,7 @@ class RestZenStore(BaseZenStore):
|
|
3978
4038
|
"""
|
3979
4039
|
response_body = self.post(f"{route}", body=resource, params=params)
|
3980
4040
|
|
3981
|
-
return response_model.
|
4041
|
+
return response_model.model_validate(response_body)
|
3982
4042
|
|
3983
4043
|
def _create_workspace_scoped_resource(
|
3984
4044
|
self,
|
@@ -4054,7 +4114,7 @@ class RestZenStore(BaseZenStore):
|
|
4054
4114
|
f"response from the {route}{GET_OR_CREATE} endpoint but got "
|
4055
4115
|
f"{type(was_created)} instead."
|
4056
4116
|
)
|
4057
|
-
return response_model.
|
4117
|
+
return response_model.model_validate(model_json), was_created
|
4058
4118
|
|
4059
4119
|
def _get_or_create_workspace_scoped_resource(
|
4060
4120
|
self,
|
@@ -4102,7 +4162,7 @@ class RestZenStore(BaseZenStore):
|
|
4102
4162
|
The retrieved resource.
|
4103
4163
|
"""
|
4104
4164
|
body = self.get(f"{route}/{str(resource_id)}", params=params)
|
4105
|
-
return response_model.
|
4165
|
+
return response_model.model_validate(body)
|
4106
4166
|
|
4107
4167
|
def _list_paginated_resources(
|
4108
4168
|
self,
|
@@ -4127,17 +4187,17 @@ class RestZenStore(BaseZenStore):
|
|
4127
4187
|
"""
|
4128
4188
|
# leave out filter params that are not supplied
|
4129
4189
|
params = params or {}
|
4130
|
-
params.update(filter_model.
|
4190
|
+
params.update(filter_model.model_dump(exclude_none=True))
|
4131
4191
|
body = self.get(f"{route}", params=params)
|
4132
4192
|
if not isinstance(body, dict):
|
4133
4193
|
raise ValueError(
|
4134
4194
|
f"Bad API Response. Expected list, got {type(body)}"
|
4135
4195
|
)
|
4136
4196
|
# The initial page of items will be of type BaseResponseModel
|
4137
|
-
page_of_items: Page[AnyResponse] = Page.
|
4197
|
+
page_of_items: Page[AnyResponse] = Page.model_validate(body)
|
4138
4198
|
# So these items will be parsed into their correct types like here
|
4139
4199
|
page_of_items.items = [
|
4140
|
-
response_model.
|
4200
|
+
response_model.model_validate(generic_item)
|
4141
4201
|
for generic_item in body["items"]
|
4142
4202
|
]
|
4143
4203
|
return page_of_items
|
@@ -4168,7 +4228,7 @@ class RestZenStore(BaseZenStore):
|
|
4168
4228
|
raise ValueError(
|
4169
4229
|
f"Bad API Response. Expected list, got {type(body)}"
|
4170
4230
|
)
|
4171
|
-
return [response_model.
|
4231
|
+
return [response_model.model_validate(entry) for entry in body]
|
4172
4232
|
|
4173
4233
|
def _update_resource(
|
4174
4234
|
self,
|
@@ -4195,7 +4255,7 @@ class RestZenStore(BaseZenStore):
|
|
4195
4255
|
f"{route}/{str(resource_id)}", body=resource_update, params=params
|
4196
4256
|
)
|
4197
4257
|
|
4198
|
-
return response_model.
|
4258
|
+
return response_model.model_validate(response_body)
|
4199
4259
|
|
4200
4260
|
def _delete_resource(
|
4201
4261
|
self, resource_id: Union[str, UUID], route: str
|
@@ -188,7 +188,7 @@ class APIKeySchema(NamedSchema, table=True):
|
|
188
188
|
Returns:
|
189
189
|
The updated `APIKeySchema`.
|
190
190
|
"""
|
191
|
-
for field, value in update.
|
191
|
+
for field, value in update.model_dump(exclude_none=True).items():
|
192
192
|
if hasattr(self, field):
|
193
193
|
setattr(self, field, value)
|
194
194
|
|
@@ -171,7 +171,7 @@ class ArtifactVersionSchema(BaseSchema, table=True):
|
|
171
171
|
# Fields
|
172
172
|
version: str
|
173
173
|
version_number: Optional[int]
|
174
|
-
type:
|
174
|
+
type: str
|
175
175
|
uri: str = Field(sa_column=Column(TEXT, nullable=False))
|
176
176
|
materializer: str = Field(sa_column=Column(TEXT, nullable=False))
|
177
177
|
data_type: str = Field(sa_column=Column(TEXT, nullable=False))
|
@@ -277,10 +277,10 @@ class ArtifactVersionSchema(BaseSchema, table=True):
|
|
277
277
|
artifact_store_id=artifact_version_request.artifact_store_id,
|
278
278
|
workspace_id=artifact_version_request.workspace,
|
279
279
|
user_id=artifact_version_request.user,
|
280
|
-
type=artifact_version_request.type,
|
280
|
+
type=artifact_version_request.type.value,
|
281
281
|
uri=artifact_version_request.uri,
|
282
|
-
materializer=artifact_version_request.materializer.
|
283
|
-
data_type=artifact_version_request.data_type.
|
282
|
+
materializer=artifact_version_request.materializer.model_dump_json(),
|
283
|
+
data_type=artifact_version_request.data_type.model_dump_json(),
|
284
284
|
)
|
285
285
|
|
286
286
|
def to_model(
|
@@ -302,13 +302,13 @@ class ArtifactVersionSchema(BaseSchema, table=True):
|
|
302
302
|
The created `ArtifactVersionResponse`.
|
303
303
|
"""
|
304
304
|
try:
|
305
|
-
materializer = Source.
|
305
|
+
materializer = Source.model_validate_json(self.materializer)
|
306
306
|
except ValidationError:
|
307
307
|
# This is an old source which was an importable source path
|
308
308
|
materializer = Source.from_import_path(self.materializer)
|
309
309
|
|
310
310
|
try:
|
311
|
-
data_type = Source.
|
311
|
+
data_type = Source.model_validate_json(self.data_type)
|
312
312
|
except ValidationError:
|
313
313
|
# This is an old source which was an importable source path
|
314
314
|
data_type = Source.from_import_path(self.data_type)
|
@@ -331,10 +331,10 @@ class ArtifactVersionSchema(BaseSchema, table=True):
|
|
331
331
|
# Create the body of the model
|
332
332
|
body = ArtifactVersionResponseBody(
|
333
333
|
artifact=self.artifact.to_model(),
|
334
|
-
version=self.
|
334
|
+
version=self.version or str(self.version_number),
|
335
335
|
user=self.user.to_model() if self.user else None,
|
336
336
|
uri=self.uri,
|
337
|
-
type=self.type,
|
337
|
+
type=ArtifactType(self.type),
|
338
338
|
materializer=materializer,
|
339
339
|
data_type=data_type,
|
340
340
|
created=self.created,
|
@@ -37,7 +37,7 @@ class ArtifactVisualizationSchema(BaseSchema, table=True):
|
|
37
37
|
__tablename__ = "artifact_visualization"
|
38
38
|
|
39
39
|
# Fields
|
40
|
-
type:
|
40
|
+
type: str
|
41
41
|
uri: str = Field(sa_column=Column(TEXT, nullable=False))
|
42
42
|
|
43
43
|
# Foreign Keys
|
@@ -71,7 +71,7 @@ class ArtifactVisualizationSchema(BaseSchema, table=True):
|
|
71
71
|
The `ArtifactVisualizationSchema`.
|
72
72
|
"""
|
73
73
|
return cls(
|
74
|
-
type=artifact_visualization_request.type,
|
74
|
+
type=artifact_visualization_request.type.value,
|
75
75
|
uri=artifact_visualization_request.uri,
|
76
76
|
artifact_version_id=artifact_version_id,
|
77
77
|
)
|
@@ -95,7 +95,7 @@ class ArtifactVisualizationSchema(BaseSchema, table=True):
|
|
95
95
|
The `Visualization`.
|
96
96
|
"""
|
97
97
|
body = ArtifactVisualizationResponseBody(
|
98
|
-
type=self.type,
|
98
|
+
type=VisualizationType(self.type),
|
99
99
|
uri=self.uri,
|
100
100
|
created=self.created,
|
101
101
|
updated=self.updated,
|