zenml-nightly 0.83.1.dev20250630__py3-none-any.whl → 0.83.1.dev20250701__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 CHANGED
@@ -1 +1 @@
1
- 0.83.1.dev20250630
1
+ 0.83.1.dev20250701
@@ -292,10 +292,6 @@ class StepLauncher:
292
292
  artifacts=step_run.outputs,
293
293
  model_version=model_version,
294
294
  )
295
- step_run_utils.cascade_tags_for_output_artifacts(
296
- artifacts=step_run.outputs,
297
- tags=pipeline_run.config.tags,
298
- )
299
295
 
300
296
  except: # noqa: E722
301
297
  logger.error(f"Pipeline run `{pipeline_run.name}` failed.")
@@ -14,9 +14,8 @@
14
14
  """Utilities for creating step runs."""
15
15
 
16
16
  import json
17
- from typing import Dict, List, Optional, Set, Tuple, Union
17
+ from typing import Dict, List, Optional, Set, Tuple
18
18
 
19
- from zenml import Tag, add_tags
20
19
  from zenml.client import Client
21
20
  from zenml.config.step_configurations import Step
22
21
  from zenml.constants import CODE_HASH_PARAMETER_NAME, TEXT_FIELD_MAX_LENGTH
@@ -404,29 +403,6 @@ def link_output_artifacts_to_model_version(
404
403
  )
405
404
 
406
405
 
407
- def cascade_tags_for_output_artifacts(
408
- artifacts: Dict[str, List[ArtifactVersionResponse]],
409
- tags: Optional[List[Union[str, Tag]]] = None,
410
- ) -> None:
411
- """Tag the outputs of a step run.
412
-
413
- Args:
414
- artifacts: The step output artifacts.
415
- tags: The tags to add to the artifacts.
416
- """
417
- if tags is None:
418
- return
419
-
420
- cascade_tags = [t for t in tags if isinstance(t, Tag) and t.cascade]
421
-
422
- for output_artifacts in artifacts.values():
423
- for output_artifact in output_artifacts:
424
- add_tags(
425
- tags=[t.name for t in cascade_tags],
426
- artifact_version_id=output_artifact.id,
427
- )
428
-
429
-
430
406
  def publish_cached_step_run(
431
407
  request: "StepRunRequest", pipeline_run: "PipelineRunResponse"
432
408
  ) -> "StepRunResponse":
@@ -447,11 +423,6 @@ def publish_cached_step_run(
447
423
  model_version=model_version,
448
424
  )
449
425
 
450
- cascade_tags_for_output_artifacts(
451
- artifacts=step_run.outputs,
452
- tags=pipeline_run.config.tags,
453
- )
454
-
455
426
  return step_run
456
427
 
457
428
 
@@ -334,6 +334,29 @@ class PipelineRunSchema(NamedSchema, RunMetadataInterface, table=True):
334
334
  trigger_execution_id=request.trigger_execution_id,
335
335
  )
336
336
 
337
+ def get_pipeline_configuration(self) -> PipelineConfiguration:
338
+ """Get the pipeline configuration for the pipeline run.
339
+
340
+ Raises:
341
+ RuntimeError: if the pipeline run has no deployment and no pipeline
342
+ configuration.
343
+
344
+ Returns:
345
+ The pipeline configuration.
346
+ """
347
+ if self.deployment:
348
+ return PipelineConfiguration.model_validate_json(
349
+ self.deployment.pipeline_configuration
350
+ )
351
+ elif self.pipeline_configuration:
352
+ return PipelineConfiguration.model_validate_json(
353
+ self.pipeline_configuration
354
+ )
355
+ else:
356
+ raise RuntimeError(
357
+ "Pipeline run has no deployment and no pipeline configuration."
358
+ )
359
+
337
360
  def fetch_metadata_collection(
338
361
  self, include_full_metadata: bool = False, **kwargs: Any
339
362
  ) -> Dict[str, List[RunMetadataEntry]]:
@@ -8835,7 +8835,6 @@ class SqlZenStore(BaseZenStore):
8835
8835
  reference_id=step_run.pipeline_run_id,
8836
8836
  session=session,
8837
8837
  )
8838
-
8839
8838
  self._get_reference_schema_by_id(
8840
8839
  resource=step_run,
8841
8840
  reference_schema=StepRunSchema,
@@ -8911,15 +8910,41 @@ class SqlZenStore(BaseZenStore):
8911
8910
  )
8912
8911
  for link in original_metadata_links
8913
8912
  ]
8914
- # Add all new links in a single operation
8915
- session.add_all(new_links)
8916
- # Commit the changes
8917
- session.commit()
8918
- session.refresh(step_schema)
8919
8913
 
8920
- session.commit()
8921
- session.refresh(step_schema)
8914
+ if new_links:
8915
+ session.add_all(new_links)
8916
+ session.commit()
8917
+ session.refresh(step_schema, ["run_metadata"])
8922
8918
 
8919
+ if step_run.status == ExecutionStatus.CACHED:
8920
+ from zenml.utils.tag_utils import Tag
8921
+
8922
+ cascading_tags = [
8923
+ tag
8924
+ for tag in run.get_pipeline_configuration().tags or []
8925
+ if isinstance(tag, Tag) and tag.cascade
8926
+ ]
8927
+
8928
+ if cascading_tags:
8929
+ output_artifact_ids = [
8930
+ id for ids in step_run.outputs.values() for id in ids
8931
+ ]
8932
+ output_artifacts = list(
8933
+ session.exec(
8934
+ select(ArtifactVersionSchema).where(
8935
+ col(ArtifactVersionSchema.id).in_(
8936
+ output_artifact_ids
8937
+ )
8938
+ )
8939
+ ).all()
8940
+ )
8941
+ self._attach_tags_to_resources(
8942
+ cascading_tags,
8943
+ resources=output_artifacts,
8944
+ session=session,
8945
+ )
8946
+
8947
+ session.commit()
8923
8948
  step_model = step_schema.to_model(include_metadata=True)
8924
8949
 
8925
8950
  for upstream_step in step_model.spec.upstream_steps:
@@ -8977,7 +9002,9 @@ class SqlZenStore(BaseZenStore):
8977
9002
  )
8978
9003
 
8979
9004
  session.commit()
8980
- session.refresh(step_schema)
9005
+ session.refresh(
9006
+ step_schema, ["input_artifacts", "output_artifacts"]
9007
+ )
8981
9008
 
8982
9009
  if model_version_id := self._get_or_create_model_version_for_run(
8983
9010
  step_schema
@@ -9330,6 +9357,9 @@ class SqlZenStore(BaseZenStore):
9330
9357
  """
9331
9358
  from zenml.orchestrators.publish_utils import get_pipeline_run_status
9332
9359
 
9360
+ # Make sure we start with a fresh transaction before locking the
9361
+ # pipeline run
9362
+ session.commit()
9333
9363
  pipeline_run = session.exec(
9334
9364
  select(PipelineRunSchema)
9335
9365
  .with_for_update()
@@ -12253,7 +12283,7 @@ class SqlZenStore(BaseZenStore):
12253
12283
  def _attach_tags_to_resources(
12254
12284
  self,
12255
12285
  tags: Optional[Sequence[Union[str, tag_utils.Tag]]],
12256
- resources: Union[BaseSchema, List[BaseSchema]],
12286
+ resources: Union[BaseSchema, Sequence[BaseSchema]],
12257
12287
  session: Session,
12258
12288
  ) -> None:
12259
12289
  """Attaches multiple tags to multiple resources.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: zenml-nightly
3
- Version: 0.83.1.dev20250630
3
+ Version: 0.83.1.dev20250701
4
4
  Summary: ZenML: Write production-ready ML code.
5
5
  License: Apache-2.0
6
6
  Keywords: machine learning,production,pipeline,mlops,devops
@@ -1,5 +1,5 @@
1
1
  zenml/README.md,sha256=827dekbOWAs1BpW7VF1a4d7EbwPbjwccX-2zdXBENZo,1777
2
- zenml/VERSION,sha256=WrfVwSohUEK3BPOX8ZbyFxfM29lgPKhmqzzlmShM9E0,19
2
+ zenml/VERSION,sha256=zRLl7Yrc1czoaP5zyl4Eo2Db6MytyIS8OwwSiRuFPSY,19
3
3
  zenml/__init__.py,sha256=r7JUg2SVDf_dPhS7iU6vudKusEqK4ics7_jFMZhq0o4,2731
4
4
  zenml/actions/__init__.py,sha256=mrt6wPo73iKRxK754_NqsGyJ3buW7RnVeIGXr1xEw8Y,681
5
5
  zenml/actions/base_action.py,sha256=UcaHev6BTuLDwuswnyaPjdA8AgUqB5xPZ-lRtuvf2FU,25553
@@ -693,8 +693,8 @@ zenml/orchestrators/local_docker/__init__.py,sha256=k8J68ydy6HmmvE9tWo32g761H8P_
693
693
  zenml/orchestrators/local_docker/local_docker_orchestrator.py,sha256=RA88Yq8K9-zj4JkcVoA1dDDZZeA-rSFv5tUIW1tUYa8,9771
694
694
  zenml/orchestrators/output_utils.py,sha256=01vqke1ZfmfuLpgxNerF-QL2wA0VPv1zUdvlMw0OwUY,3508
695
695
  zenml/orchestrators/publish_utils.py,sha256=CSQKhx2f9r2knldDCuPR0lmVyRwI-Ps6Xbihfhxv21U,5477
696
- zenml/orchestrators/step_launcher.py,sha256=6hrLj0Dr5-FcKTm3cvLVnr3PuUpaYbyEs1MRQdAVzys,18064
697
- zenml/orchestrators/step_run_utils.py,sha256=SZjVSkmO9Vvjb2ZqQembOjg3jTU2wHXAykwlVxQNVBg,17051
696
+ zenml/orchestrators/step_launcher.py,sha256=Dgimw9B2ZsrRPddZb6L25fmozUlnD8uBFykhPdS-SMM,17865
697
+ zenml/orchestrators/step_run_utils.py,sha256=ppCEAqB0UBtLCm4FuWjgeAS0wxAa8uivxgTOL7Abrn8,16228
698
698
  zenml/orchestrators/step_runner.py,sha256=EUgKG_g0fOQ6gnB1hPSSa6UXwUKVkguC-Yj-Q0yEQXg,26632
699
699
  zenml/orchestrators/topsort.py,sha256=D8evz3X47zwpXd90NMLsJD-_uCeXtV6ClzNfDUrq7cM,5784
700
700
  zenml/orchestrators/utils.py,sha256=6bqLc1fmdJTXg8JUwUKs8YNbmxTuMIfWmUbUpg-7hx0,12956
@@ -1308,7 +1308,7 @@ zenml/zen_stores/schemas/logs_schemas.py,sha256=qv6fs3JiVgzlmTXJqb_gG5NsU5q_50e0
1308
1308
  zenml/zen_stores/schemas/model_schemas.py,sha256=cDhWggrn3rTjaFML3iQGuW_4CpUJUxAnHieiY-dq0y4,26006
1309
1309
  zenml/zen_stores/schemas/pipeline_build_schemas.py,sha256=8GMdJNNcoSnbYH9daVr8zrhwQ1n-HZrpgzHoBZ7DZyA,7320
1310
1310
  zenml/zen_stores/schemas/pipeline_deployment_schemas.py,sha256=wCZVo8khyMOPMcO9e1itAb_3ehWFObCpgl6Pp2Yz88k,14780
1311
- zenml/zen_stores/schemas/pipeline_run_schemas.py,sha256=nL4E5LMbB2jl_wOG6EbJp2XkaJNL_p4HkAVjoZNpmsU,21974
1311
+ zenml/zen_stores/schemas/pipeline_run_schemas.py,sha256=zAtLdTv9C_gDltEMZV5foHyMvDrFRKnE6yoYGW2w14Y,22765
1312
1312
  zenml/zen_stores/schemas/pipeline_schemas.py,sha256=xgioTeBuFFFDOJi5eESx2j-8mW55B6hshosFylev5Mw,8213
1313
1313
  zenml/zen_stores/schemas/project_schemas.py,sha256=X2GClPNQz0COsEZX8xI-I8Sm68Hb6f20Obm24mQyLS0,6013
1314
1314
  zenml/zen_stores/schemas/run_metadata_schemas.py,sha256=G94rT4ldluMSnf9rm7R_9rw_GlgaAyq72ptkHl0gHeg,3605
@@ -1334,11 +1334,11 @@ zenml/zen_stores/secrets_stores/hashicorp_secrets_store.py,sha256=5err1a-TrV3SR5
1334
1334
  zenml/zen_stores/secrets_stores/secrets_store_interface.py,sha256=Q2Jbnt2Pp7NGlR-u1YBfRZV2g8su2Fd0ArBMdksAE-Q,2819
1335
1335
  zenml/zen_stores/secrets_stores/service_connector_secrets_store.py,sha256=DrXGMkBxQIy2n_kkux5Xh2OM3Ks3MOpqP1D4aY8bfyY,7047
1336
1336
  zenml/zen_stores/secrets_stores/sql_secrets_store.py,sha256=LPFW757WCJLP1S8vrvjsrl2Tf1yo281xUTjSBsos4qk,8788
1337
- zenml/zen_stores/sql_zen_store.py,sha256=vir5WfbwPyZz7bIuxRzT5WHG_qkL5ijhWpSw4nGBfIU,481114
1337
+ zenml/zen_stores/sql_zen_store.py,sha256=Fj4AGUiEV-C1X-sXig-jeZEHCwih6Zr1BtoySOewF0o,482335
1338
1338
  zenml/zen_stores/template_utils.py,sha256=GbJ7LgGVYHSCKPEA8RNTxPoVTWqpC77F_lGzjJ4O1Fw,9220
1339
1339
  zenml/zen_stores/zen_store_interface.py,sha256=weiSULdI9AsbCE10a5TcwtybX-BJs9hKhjPJnTapWv4,93023
1340
- zenml_nightly-0.83.1.dev20250630.dist-info/LICENSE,sha256=wbnfEnXnafPbqwANHkV6LUsPKOtdpsd-SNw37rogLtc,11359
1341
- zenml_nightly-0.83.1.dev20250630.dist-info/METADATA,sha256=iqPa9J_37jEnWDXnyIlj0H7qioWrS7QbLhuOirEwAUg,24316
1342
- zenml_nightly-0.83.1.dev20250630.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
1343
- zenml_nightly-0.83.1.dev20250630.dist-info/entry_points.txt,sha256=QK3ETQE0YswAM2mWypNMOv8TLtr7EjnqAFq1br_jEFE,43
1344
- zenml_nightly-0.83.1.dev20250630.dist-info/RECORD,,
1340
+ zenml_nightly-0.83.1.dev20250701.dist-info/LICENSE,sha256=wbnfEnXnafPbqwANHkV6LUsPKOtdpsd-SNw37rogLtc,11359
1341
+ zenml_nightly-0.83.1.dev20250701.dist-info/METADATA,sha256=ilUaqUT6bEBqoOBJZs-fP4Mk7AClW24TdQ7mqFYZrzQ,24316
1342
+ zenml_nightly-0.83.1.dev20250701.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
1343
+ zenml_nightly-0.83.1.dev20250701.dist-info/entry_points.txt,sha256=QK3ETQE0YswAM2mWypNMOv8TLtr7EjnqAFq1br_jEFE,43
1344
+ zenml_nightly-0.83.1.dev20250701.dist-info/RECORD,,