zenml-nightly 0.75.0.dev20250312__py3-none-any.whl → 0.75.0.dev20250314__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 (191) hide show
  1. zenml/VERSION +1 -1
  2. zenml/__init__.py +2 -0
  3. zenml/analytics/context.py +7 -0
  4. zenml/analytics/enums.py +2 -2
  5. zenml/artifacts/utils.py +2 -4
  6. zenml/cli/__init__.py +8 -9
  7. zenml/cli/base.py +2 -2
  8. zenml/cli/code_repository.py +1 -1
  9. zenml/cli/login.py +6 -0
  10. zenml/cli/model.py +7 -15
  11. zenml/cli/pipeline.py +3 -3
  12. zenml/cli/project.py +172 -0
  13. zenml/cli/secret.py +47 -44
  14. zenml/cli/service_accounts.py +0 -1
  15. zenml/cli/service_connectors.py +15 -17
  16. zenml/cli/stack.py +0 -3
  17. zenml/cli/stack_components.py +2 -2
  18. zenml/cli/tag.py +3 -5
  19. zenml/cli/utils.py +25 -23
  20. zenml/client.py +749 -475
  21. zenml/config/global_config.py +48 -37
  22. zenml/config/pipeline_configurations.py +3 -2
  23. zenml/config/pipeline_run_configuration.py +2 -1
  24. zenml/config/secret_reference_mixin.py +1 -1
  25. zenml/constants.py +6 -6
  26. zenml/enums.py +0 -7
  27. zenml/event_hub/event_hub.py +3 -1
  28. zenml/exceptions.py +0 -24
  29. zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py +5 -3
  30. zenml/integrations/bitbucket/plugins/event_sources/bitbucket_webhook_event_source.py +1 -4
  31. zenml/integrations/gcp/service_connectors/gcp_service_connector.py +7 -6
  32. zenml/integrations/github/plugins/event_sources/github_webhook_event_source.py +1 -4
  33. zenml/integrations/mlflow/steps/mlflow_registry.py +3 -3
  34. zenml/integrations/seldon/model_deployers/seldon_model_deployer.py +1 -1
  35. zenml/integrations/wandb/__init__.py +1 -1
  36. zenml/integrations/wandb/experiment_trackers/wandb_experiment_tracker.py +29 -9
  37. zenml/integrations/wandb/flavors/wandb_experiment_tracker_flavor.py +5 -3
  38. zenml/model/model.py +10 -10
  39. zenml/model_registries/base_model_registry.py +1 -1
  40. zenml/models/__init__.py +45 -28
  41. zenml/models/v2/base/base.py +0 -5
  42. zenml/models/v2/base/filter.py +2 -2
  43. zenml/models/v2/base/scoped.py +135 -156
  44. zenml/models/v2/core/action.py +12 -12
  45. zenml/models/v2/core/api_key.py +1 -1
  46. zenml/models/v2/core/artifact.py +31 -18
  47. zenml/models/v2/core/artifact_version.py +57 -40
  48. zenml/models/v2/core/code_repository.py +12 -12
  49. zenml/models/v2/core/component.py +22 -33
  50. zenml/models/v2/core/device.py +3 -2
  51. zenml/models/v2/core/event_source.py +14 -14
  52. zenml/models/v2/core/flavor.py +19 -47
  53. zenml/models/v2/core/logs.py +1 -2
  54. zenml/models/v2/core/model.py +23 -20
  55. zenml/models/v2/core/model_version.py +51 -42
  56. zenml/models/v2/core/pipeline.py +16 -16
  57. zenml/models/v2/core/pipeline_build.py +14 -14
  58. zenml/models/v2/core/pipeline_deployment.py +12 -14
  59. zenml/models/v2/core/pipeline_run.py +21 -29
  60. zenml/models/v2/core/project.py +203 -0
  61. zenml/models/v2/core/run_metadata.py +2 -2
  62. zenml/models/v2/core/run_template.py +16 -17
  63. zenml/models/v2/core/schedule.py +12 -21
  64. zenml/models/v2/core/secret.py +94 -128
  65. zenml/models/v2/core/server_settings.py +2 -2
  66. zenml/models/v2/core/service.py +57 -26
  67. zenml/models/v2/core/service_connector.py +14 -16
  68. zenml/models/v2/core/stack.py +24 -26
  69. zenml/models/v2/core/step_run.py +16 -28
  70. zenml/models/v2/core/tag.py +41 -15
  71. zenml/models/v2/core/trigger.py +13 -13
  72. zenml/models/v2/core/trigger_execution.py +2 -2
  73. zenml/models/v2/core/user.py +2 -2
  74. zenml/models/v2/misc/statistics.py +45 -0
  75. zenml/models/v2/misc/tag.py +27 -0
  76. zenml/orchestrators/cache_utils.py +7 -7
  77. zenml/orchestrators/input_utils.py +1 -0
  78. zenml/orchestrators/step_launcher.py +1 -2
  79. zenml/orchestrators/step_run_utils.py +2 -4
  80. zenml/orchestrators/step_runner.py +10 -1
  81. zenml/orchestrators/utils.py +4 -4
  82. zenml/pipelines/build_utils.py +2 -4
  83. zenml/pipelines/pipeline_decorator.py +3 -2
  84. zenml/pipelines/pipeline_definition.py +8 -9
  85. zenml/pipelines/run_utils.py +4 -4
  86. zenml/service_connectors/service_connector.py +0 -10
  87. zenml/service_connectors/service_connector_utils.py +0 -2
  88. zenml/stack/authentication_mixin.py +1 -1
  89. zenml/stack/flavor.py +3 -14
  90. zenml/stack/stack.py +0 -1
  91. zenml/stack/stack_component.py +1 -5
  92. zenml/steps/base_step.py +10 -2
  93. zenml/steps/step_context.py +19 -0
  94. zenml/utils/string_utils.py +1 -1
  95. zenml/utils/tag_utils.py +642 -0
  96. zenml/zen_server/cloud_utils.py +21 -0
  97. zenml/zen_server/exceptions.py +0 -6
  98. zenml/zen_server/rbac/endpoint_utils.py +134 -46
  99. zenml/zen_server/rbac/models.py +65 -3
  100. zenml/zen_server/rbac/rbac_interface.py +9 -0
  101. zenml/zen_server/rbac/rbac_sql_zen_store.py +15 -7
  102. zenml/zen_server/rbac/utils.py +155 -30
  103. zenml/zen_server/rbac/zenml_cloud_rbac.py +39 -11
  104. zenml/zen_server/routers/actions_endpoints.py +3 -5
  105. zenml/zen_server/routers/artifact_endpoint.py +0 -5
  106. zenml/zen_server/routers/artifact_version_endpoints.py +15 -9
  107. zenml/zen_server/routers/auth_endpoints.py +22 -7
  108. zenml/zen_server/routers/code_repositories_endpoints.py +54 -3
  109. zenml/zen_server/routers/devices_endpoints.py +0 -4
  110. zenml/zen_server/routers/event_source_endpoints.py +0 -5
  111. zenml/zen_server/routers/flavors_endpoints.py +0 -5
  112. zenml/zen_server/routers/logs_endpoints.py +0 -1
  113. zenml/zen_server/routers/model_versions_endpoints.py +100 -23
  114. zenml/zen_server/routers/models_endpoints.py +50 -69
  115. zenml/zen_server/routers/pipeline_builds_endpoints.py +55 -3
  116. zenml/zen_server/routers/pipeline_deployments_endpoints.py +56 -4
  117. zenml/zen_server/routers/pipelines_endpoints.py +70 -3
  118. zenml/zen_server/routers/plugin_endpoints.py +0 -1
  119. zenml/zen_server/routers/projects_endpoints.py +283 -0
  120. zenml/zen_server/routers/run_metadata_endpoints.py +97 -0
  121. zenml/zen_server/routers/run_templates_endpoints.py +64 -3
  122. zenml/zen_server/routers/runs_endpoints.py +58 -8
  123. zenml/zen_server/routers/schedule_endpoints.py +67 -6
  124. zenml/zen_server/routers/secrets_endpoints.py +38 -4
  125. zenml/zen_server/routers/server_endpoints.py +53 -1
  126. zenml/zen_server/routers/service_accounts_endpoints.py +14 -15
  127. zenml/zen_server/routers/service_connectors_endpoints.py +94 -14
  128. zenml/zen_server/routers/service_endpoints.py +18 -7
  129. zenml/zen_server/routers/stack_components_endpoints.py +66 -7
  130. zenml/zen_server/routers/stacks_endpoints.py +95 -6
  131. zenml/zen_server/routers/steps_endpoints.py +17 -11
  132. zenml/zen_server/routers/tag_resource_endpoints.py +115 -0
  133. zenml/zen_server/routers/tags_endpoints.py +6 -17
  134. zenml/zen_server/routers/triggers_endpoints.py +5 -8
  135. zenml/zen_server/routers/users_endpoints.py +9 -12
  136. zenml/zen_server/template_execution/utils.py +8 -7
  137. zenml/zen_server/utils.py +21 -0
  138. zenml/zen_server/zen_server_api.py +7 -2
  139. zenml/zen_stores/base_zen_store.py +50 -69
  140. zenml/zen_stores/migrations/versions/12eff0206201_rename_workspace_to_project.py +768 -0
  141. zenml/zen_stores/migrations/versions/1cb6477f72d6_move_artifact_save_type.py +20 -10
  142. zenml/zen_stores/migrations/versions/1f9d1cd00b90_add_unique_name_constraints.py +231 -0
  143. zenml/zen_stores/migrations/versions/288f4fb6e112_make_tags_user_scoped.py +74 -0
  144. zenml/zen_stores/migrations/versions/2e695a26fe7a_add_user_default_workspace.py +45 -0
  145. zenml/zen_stores/migrations/versions/3b1776345020_remove_workspace_from_globals.py +81 -0
  146. zenml/zen_stores/migrations/versions/41b28cae31ce_make_artifacts_workspace_scoped.py +136 -0
  147. zenml/zen_stores/migrations/versions/9e7bf0970266_adding_exclusive_attribute_to_tags.py +47 -0
  148. zenml/zen_stores/migrations/versions/b557b2871693_update_step_run_input_types.py +8 -4
  149. zenml/zen_stores/migrations/versions/cbc6acd71f92_add_workspace_display_name.py +58 -0
  150. zenml/zen_stores/migrations/versions/cc269488e5a9_separate_run_metadata.py +12 -6
  151. zenml/zen_stores/migrations/versions/f1d723fd723b_add_secret_private_attr.py +61 -0
  152. zenml/zen_stores/migrations/versions/f76a368a25a5_add_stack_description.py +35 -0
  153. zenml/zen_stores/rest_zen_store.py +223 -230
  154. zenml/zen_stores/schemas/__init__.py +2 -2
  155. zenml/zen_stores/schemas/action_schemas.py +15 -8
  156. zenml/zen_stores/schemas/api_key_schemas.py +8 -1
  157. zenml/zen_stores/schemas/artifact_schemas.py +35 -10
  158. zenml/zen_stores/schemas/code_repository_schemas.py +22 -17
  159. zenml/zen_stores/schemas/component_schemas.py +9 -14
  160. zenml/zen_stores/schemas/event_source_schemas.py +15 -8
  161. zenml/zen_stores/schemas/flavor_schemas.py +14 -20
  162. zenml/zen_stores/schemas/model_schemas.py +18 -17
  163. zenml/zen_stores/schemas/pipeline_build_schemas.py +7 -7
  164. zenml/zen_stores/schemas/pipeline_deployment_schemas.py +10 -8
  165. zenml/zen_stores/schemas/pipeline_run_schemas.py +9 -12
  166. zenml/zen_stores/schemas/pipeline_schemas.py +9 -9
  167. zenml/zen_stores/schemas/{workspace_schemas.py → project_schemas.py} +53 -65
  168. zenml/zen_stores/schemas/run_metadata_schemas.py +5 -5
  169. zenml/zen_stores/schemas/run_template_schemas.py +17 -13
  170. zenml/zen_stores/schemas/schedule_schema.py +16 -21
  171. zenml/zen_stores/schemas/secret_schemas.py +15 -25
  172. zenml/zen_stores/schemas/service_connector_schemas.py +8 -17
  173. zenml/zen_stores/schemas/service_schemas.py +7 -8
  174. zenml/zen_stores/schemas/stack_schemas.py +12 -15
  175. zenml/zen_stores/schemas/step_run_schemas.py +14 -15
  176. zenml/zen_stores/schemas/tag_schemas.py +30 -2
  177. zenml/zen_stores/schemas/trigger_schemas.py +15 -8
  178. zenml/zen_stores/schemas/user_schemas.py +12 -2
  179. zenml/zen_stores/schemas/utils.py +16 -0
  180. zenml/zen_stores/secrets_stores/service_connector_secrets_store.py +0 -3
  181. zenml/zen_stores/sql_zen_store.py +2984 -2369
  182. zenml/zen_stores/template_utils.py +1 -1
  183. zenml/zen_stores/zen_store_interface.py +136 -126
  184. {zenml_nightly-0.75.0.dev20250312.dist-info → zenml_nightly-0.75.0.dev20250314.dist-info}/METADATA +1 -1
  185. {zenml_nightly-0.75.0.dev20250312.dist-info → zenml_nightly-0.75.0.dev20250314.dist-info}/RECORD +188 -173
  186. zenml/cli/workspace.py +0 -86
  187. zenml/models/v2/core/workspace.py +0 -131
  188. zenml/zen_server/routers/workspaces_endpoints.py +0 -1469
  189. {zenml_nightly-0.75.0.dev20250312.dist-info → zenml_nightly-0.75.0.dev20250314.dist-info}/LICENSE +0 -0
  190. {zenml_nightly-0.75.0.dev20250312.dist-info → zenml_nightly-0.75.0.dev20250314.dist-info}/WHEEL +0 -0
  191. {zenml_nightly-0.75.0.dev20250312.dist-info → zenml_nightly-0.75.0.dev20250314.dist-info}/entry_points.txt +0 -0
@@ -215,8 +215,7 @@ def reuse_or_create_pipeline_build(
215
215
  build_model = Client().zen_store.get_build(build_id=build)
216
216
  else:
217
217
  build_request = PipelineBuildRequest(
218
- user=Client().active_user.id,
219
- workspace=Client().active_workspace.id,
218
+ project=Client().active_project.id,
220
219
  stack=Client().active_stack_model.id,
221
220
  pipeline=pipeline_id,
222
221
  **build.model_dump(),
@@ -419,8 +418,7 @@ def create_pipeline_build(
419
418
  )
420
419
  stack_checksum = compute_stack_checksum(stack=stack_model)
421
420
  build_request = PipelineBuildRequest(
422
- user=client.active_user.id,
423
- workspace=client.active_workspace.id,
421
+ project=client.active_project.id,
424
422
  stack=stack_model.id,
425
423
  pipeline=pipeline_id,
426
424
  is_local=is_local,
@@ -32,6 +32,7 @@ if TYPE_CHECKING:
32
32
  from zenml.model.model import Model
33
33
  from zenml.pipelines.pipeline_definition import Pipeline
34
34
  from zenml.types import HookSpecification
35
+ from zenml.utils.tag_utils import Tag
35
36
 
36
37
  F = TypeVar("F", bound=Callable[..., None])
37
38
 
@@ -50,7 +51,7 @@ def pipeline(
50
51
  enable_artifact_metadata: Optional[bool] = None,
51
52
  enable_step_logs: Optional[bool] = None,
52
53
  settings: Optional[Dict[str, "SettingsOrDict"]] = None,
53
- tags: Optional[List[str]] = None,
54
+ tags: Optional[List[Union[str, "Tag"]]] = None,
54
55
  extra: Optional[Dict[str, Any]] = None,
55
56
  on_failure: Optional["HookSpecification"] = None,
56
57
  on_success: Optional["HookSpecification"] = None,
@@ -67,7 +68,7 @@ def pipeline(
67
68
  enable_artifact_metadata: Optional[bool] = None,
68
69
  enable_step_logs: Optional[bool] = None,
69
70
  settings: Optional[Dict[str, "SettingsOrDict"]] = None,
70
- tags: Optional[List[str]] = None,
71
+ tags: Optional[List[Union[str, "Tag"]]] = None,
71
72
  extra: Optional[Dict[str, Any]] = None,
72
73
  on_failure: Optional["HookSpecification"] = None,
73
74
  on_success: Optional["HookSpecification"] = None,
@@ -93,6 +93,7 @@ from zenml.utils import (
93
93
  yaml_utils,
94
94
  )
95
95
  from zenml.utils.string_utils import format_name_template
96
+ from zenml.utils.tag_utils import Tag
96
97
 
97
98
  if TYPE_CHECKING:
98
99
  from zenml.artifacts.external_artifact import ExternalArtifact
@@ -130,7 +131,7 @@ class Pipeline:
130
131
  enable_artifact_visualization: Optional[bool] = None,
131
132
  enable_step_logs: Optional[bool] = None,
132
133
  settings: Optional[Mapping[str, "SettingsOrDict"]] = None,
133
- tags: Optional[List[str]] = None,
134
+ tags: Optional[List[Union[str, "Tag"]]] = None,
134
135
  extra: Optional[Dict[str, Any]] = None,
135
136
  on_failure: Optional["HookSpecification"] = None,
136
137
  on_success: Optional["HookSpecification"] = None,
@@ -293,7 +294,7 @@ class Pipeline:
293
294
  enable_artifact_visualization: Optional[bool] = None,
294
295
  enable_step_logs: Optional[bool] = None,
295
296
  settings: Optional[Mapping[str, "SettingsOrDict"]] = None,
296
- tags: Optional[List[str]] = None,
297
+ tags: Optional[List[Union[str, "Tag"]]] = None,
297
298
  extra: Optional[Dict[str, Any]] = None,
298
299
  on_failure: Optional["HookSpecification"] = None,
299
300
  on_success: Optional["HookSpecification"] = None,
@@ -683,8 +684,7 @@ To avoid this consider setting pipeline parameters only in one place (config or
683
684
  components = Client().active_stack_model.components
684
685
  orchestrator = components[StackComponentType.ORCHESTRATOR][0]
685
686
  schedule_model = ScheduleRequest(
686
- workspace=Client().active_workspace.id,
687
- user=Client().active_user.id,
687
+ project=Client().active_project.id,
688
688
  pipeline_id=pipeline_id,
689
689
  orchestrator_id=orchestrator.id,
690
690
  name=schedule_name,
@@ -770,8 +770,7 @@ To avoid this consider setting pipeline parameters only in one place (config or
770
770
  code_path = code_utils.upload_code_if_necessary(code_archive)
771
771
 
772
772
  request = PipelineDeploymentRequest(
773
- user=Client().active_user.id,
774
- workspace=Client().active_workspace.id,
773
+ project=Client().active_project.id,
775
774
  stack=stack.id,
776
775
  pipeline=pipeline_id,
777
776
  build=build_id,
@@ -1014,6 +1013,7 @@ To avoid this consider setting pipeline parameters only in one place (config or
1014
1013
  for component_type, component in stack.components.items()
1015
1014
  }
1016
1015
  return {
1016
+ "project_id": deployment.project.id,
1017
1017
  "store_type": Client().zen_store.type.value,
1018
1018
  **stack_metadata,
1019
1019
  "total_steps": len(self.invocations),
@@ -1094,8 +1094,7 @@ To avoid this consider setting pipeline parameters only in one place (config or
1094
1094
  return _get()
1095
1095
  except RuntimeError:
1096
1096
  request = PipelineRequest(
1097
- workspace=client.active_workspace.id,
1098
- user=client.active_user.id,
1097
+ project=client.active_project.id,
1099
1098
  name=self.name,
1100
1099
  )
1101
1100
 
@@ -1234,7 +1233,7 @@ To avoid this consider setting pipeline parameters only in one place (config or
1234
1233
  return id_
1235
1234
 
1236
1235
  if not allow_suffix:
1237
- raise RuntimeError("Duplicate step ID")
1236
+ raise RuntimeError(f"Duplicate step ID `{id_}`")
1238
1237
 
1239
1238
  for index in range(2, 10000):
1240
1239
  id_ = f"{base_id}_{index}"
@@ -81,14 +81,14 @@ def create_placeholder_run(
81
81
  # running.
82
82
  start_time=start_time,
83
83
  orchestrator_run_id=None,
84
- user=deployment.user.id,
85
- workspace=deployment.workspace.id,
84
+ project=deployment.project.id,
86
85
  deployment=deployment.id,
87
86
  pipeline=deployment.pipeline.id if deployment.pipeline else None,
88
87
  status=ExecutionStatus.INITIALIZING,
89
88
  tags=deployment.pipeline_configuration.tags,
90
89
  )
91
- return Client().zen_store.create_run(run_request)
90
+ run, _ = Client().zen_store.get_or_create_run(run_request)
91
+ return run
92
92
 
93
93
 
94
94
  def get_placeholder_run(
@@ -213,7 +213,7 @@ def validate_stack_is_runnable_from_server(
213
213
  assert len(flavors) == 1
214
214
  flavor_model = flavors[0]
215
215
 
216
- if flavor_model.workspace is not None:
216
+ if flavor_model.is_custom:
217
217
  raise ValueError("No custom stack component flavors allowed.")
218
218
 
219
219
  flavor = Flavor.from_model(flavor_model)
@@ -53,7 +53,6 @@ from zenml.models import (
53
53
  ServiceConnectorTypedResourcesModel,
54
54
  ServiceConnectorTypeModel,
55
55
  UserResponse,
56
- WorkspaceResponse,
57
56
  )
58
57
  from zenml.utils.time_utils import utc_now
59
58
 
@@ -706,8 +705,6 @@ class ServiceConnector(BaseModel, metaclass=ServiceConnectorMeta):
706
705
 
707
706
  def to_model(
708
707
  self,
709
- user: UUID,
710
- workspace: UUID,
711
708
  name: Optional[str] = None,
712
709
  description: str = "",
713
710
  labels: Optional[Dict[str, str]] = None,
@@ -716,8 +713,6 @@ class ServiceConnector(BaseModel, metaclass=ServiceConnectorMeta):
716
713
 
717
714
  Args:
718
715
  name: The name of the connector.
719
- user: The ID of the user that created the connector.
720
- workspace: The ID of the workspace that the connector belongs to.
721
716
  description: The description of the connector.
722
717
  labels: The labels of the connector.
723
718
 
@@ -740,8 +735,6 @@ class ServiceConnector(BaseModel, metaclass=ServiceConnectorMeta):
740
735
  connector_type=spec.connector_type,
741
736
  name=name,
742
737
  description=description,
743
- user=user,
744
- workspace=workspace,
745
738
  auth_method=self.auth_method,
746
739
  expires_at=self.expires_at,
747
740
  expires_skew_tolerance=self.expires_skew_tolerance,
@@ -762,7 +755,6 @@ class ServiceConnector(BaseModel, metaclass=ServiceConnectorMeta):
762
755
 
763
756
  def to_response_model(
764
757
  self,
765
- workspace: WorkspaceResponse,
766
758
  user: Optional[UserResponse] = None,
767
759
  name: Optional[str] = None,
768
760
  id: Optional[UUID] = None,
@@ -772,7 +764,6 @@ class ServiceConnector(BaseModel, metaclass=ServiceConnectorMeta):
772
764
  """Convert the connector instance to a service connector response model.
773
765
 
774
766
  Args:
775
- workspace: The workspace that the connector belongs to.
776
767
  user: The user that created the connector.
777
768
  name: The name of the connector.
778
769
  id: The ID of the connector.
@@ -810,7 +801,6 @@ class ServiceConnector(BaseModel, metaclass=ServiceConnectorMeta):
810
801
  expires_skew_tolerance=self.expires_skew_tolerance,
811
802
  ),
812
803
  metadata=ServiceConnectorResponseMetadata(
813
- workspace=workspace,
814
804
  expiration_seconds=self.expiration_seconds,
815
805
  labels=labels or {},
816
806
  ),
@@ -184,8 +184,6 @@ def get_resources_options_from_resource_model_for_full_stack(
184
184
  else:
185
185
  resource_model = zen_store.verify_service_connector_config(
186
186
  service_connector=ServiceConnectorRequest(
187
- user=client.active_user.id,
188
- workspace=client.active_workspace.id,
189
187
  name="fake",
190
188
  connector_type=connector_details.type,
191
189
  auth_method=connector_details.auth_method,
@@ -71,7 +71,7 @@ class AuthenticationMixin(StackComponent):
71
71
 
72
72
  # Try to resolve the secret using the secret store
73
73
  try:
74
- return Client().get_secret_by_name_and_scope(
74
+ return Client().get_secret_by_name_and_private_status(
75
75
  name=self.config.authentication_secret,
76
76
  )
77
77
  except (KeyError, NotImplementedError):
zenml/stack/flavor.py CHANGED
@@ -17,7 +17,6 @@ import os
17
17
  from abc import abstractmethod
18
18
  from typing import Any, Dict, Optional, Type, cast
19
19
 
20
- from zenml.client import Client
21
20
  from zenml.enums import StackComponentType
22
21
  from zenml.exceptions import CustomFlavorImportError
23
22
  from zenml.models import (
@@ -25,7 +24,6 @@ from zenml.models import (
25
24
  FlavorResponse,
26
25
  ServiceConnectorRequirements,
27
26
  )
28
- from zenml.models.v2.core.flavor import InternalFlavorRequest
29
27
  from zenml.stack.stack_component import StackComponent, StackComponentConfig
30
28
  from zenml.utils import source_utils
31
29
  from zenml.utils.package_utils import is_latest_zenml_version
@@ -167,8 +165,7 @@ class Flavor:
167
165
 
168
166
  Args:
169
167
  integration: The integration to use for the model.
170
- is_custom: Whether the flavor is a custom flavor. Custom flavors
171
- are then scoped by user and workspace
168
+ is_custom: Whether the flavor is a custom flavor.
172
169
 
173
170
  Returns:
174
171
  The model.
@@ -189,16 +186,8 @@ class Flavor:
189
186
  if connector_requirements
190
187
  else None
191
188
  )
192
- user = None
193
- workspace = None
194
- if is_custom:
195
- user = Client().active_user.id
196
- workspace = Client().active_workspace.id
197
-
198
- model_class = FlavorRequest if is_custom else InternalFlavorRequest
199
- model = model_class(
200
- user=user,
201
- workspace=workspace,
189
+
190
+ model = FlavorRequest(
202
191
  name=self.name,
203
192
  type=self.type,
204
193
  source=source_utils.resolve(self.__class__).import_path,
zenml/stack/stack.py CHANGED
@@ -756,7 +756,6 @@ class Stack:
756
756
  type=flavor.type,
757
757
  config=LocalImageBuilderConfig(),
758
758
  user=Client().active_user.id,
759
- workspace=Client().active_workspace.id,
760
759
  created=now,
761
760
  updated=now,
762
761
  )
@@ -215,7 +215,7 @@ class StackComponentConfig(BaseModel, ABC):
215
215
 
216
216
  # Try to resolve the secret using the secret store
217
217
  try:
218
- secret = Client().get_secret_by_name_and_scope(
218
+ secret = Client().get_secret_by_name_and_private_status(
219
219
  name=secret_ref.name,
220
220
  )
221
221
  except (KeyError, NotImplementedError):
@@ -333,7 +333,6 @@ class StackComponent:
333
333
  flavor: str,
334
334
  type: StackComponentType,
335
335
  user: Optional[UUID],
336
- workspace: UUID,
337
336
  created: datetime,
338
337
  updated: datetime,
339
338
  labels: Optional[Dict[str, Any]] = None,
@@ -352,7 +351,6 @@ class StackComponent:
352
351
  flavor: The flavor of the component.
353
352
  type: The type of the component.
354
353
  user: The ID of the user who created the component.
355
- workspace: The ID of the workspace the component belongs to.
356
354
  created: The creation time of the component.
357
355
  updated: The last update time of the component.
358
356
  labels: The labels of the component.
@@ -378,7 +376,6 @@ class StackComponent:
378
376
  self.flavor = flavor
379
377
  self.type = type
380
378
  self.user = user
381
- self.workspace = workspace
382
379
  self.created = created
383
380
  self.updated = updated
384
381
  self.labels = labels
@@ -417,7 +414,6 @@ class StackComponent:
417
414
  try:
418
415
  return flavor.implementation_class(
419
416
  user=user_id,
420
- workspace=component_model.workspace.id,
421
417
  name=component_model.name,
422
418
  id=component_model.id,
423
419
  config=configuration,
zenml/steps/base_step.py CHANGED
@@ -432,7 +432,9 @@ class BaseStep:
432
432
  self,
433
433
  *args: Any,
434
434
  id: Optional[str] = None,
435
- after: Union[str, Sequence[str], None] = None,
435
+ after: Union[
436
+ str, StepArtifact, Sequence[Union[str, StepArtifact]], None
437
+ ] = None,
436
438
  **kwargs: Any,
437
439
  ) -> Any:
438
440
  """Handle a call of the step.
@@ -497,8 +499,14 @@ class BaseStep:
497
499
  }
498
500
  if isinstance(after, str):
499
501
  upstream_steps.add(after)
502
+ elif isinstance(after, StepArtifact):
503
+ upstream_steps.add(after.invocation_id)
500
504
  elif isinstance(after, Sequence):
501
- upstream_steps = upstream_steps.union(after)
505
+ for item in after:
506
+ if isinstance(item, str):
507
+ upstream_steps.add(item)
508
+ elif isinstance(item, StepArtifact):
509
+ upstream_steps.add(item.invocation_id)
502
510
 
503
511
  invocation_id = Pipeline.ACTIVE_PIPELINE.add_step_invocation(
504
512
  step=self,
@@ -384,6 +384,25 @@ class StepContext(metaclass=SingletonMetaClass):
384
384
  output.tags = []
385
385
  output.tags += tags
386
386
 
387
+ def remove_output_tags(
388
+ self,
389
+ tags: List[str],
390
+ output_name: Optional[str] = None,
391
+ ) -> None:
392
+ """Removes tags for a given step output.
393
+
394
+ Args:
395
+ tags: The tags to remove.
396
+ output_name: Optional name of the output for which to remove the
397
+ tags. If no name is given and the step only has a single
398
+ output, the tags of this output will be removed. If the
399
+ step has multiple outputs, an exception will be raised.
400
+ """
401
+ output = self._get_output(output_name)
402
+ if not output.tags:
403
+ return
404
+ output.tags = [tag for tag in output.tags if tag not in tags]
405
+
387
406
 
388
407
  class StepContextOutput:
389
408
  """Represents a step output in the step context."""
@@ -101,7 +101,7 @@ def b64_decode(input_: str) -> str:
101
101
 
102
102
 
103
103
  def random_str(length: int) -> str:
104
- """Generate a random human readable string of given length.
104
+ """Generate a random human-readable string of given length.
105
105
 
106
106
  Args:
107
107
  length: Length of string