Skip to content

Commit

Permalink
Improved deprecation messages for artifact configs and run metadata (#…
Browse files Browse the repository at this point in the history
…3261)

* improved deprecation messages

* Update src/zenml/model/utils.py

Co-authored-by: Alexej Penner <[email protected]>

* Update src/zenml/artifacts/utils.py

Co-authored-by: Alexej Penner <[email protected]>

* fixed it again

---------

Co-authored-by: Alexej Penner <[email protected]>
  • Loading branch information
bcdurak and AlexejPenner authored Dec 12, 2024
1 parent ec1ac38 commit 96034f9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
13 changes: 8 additions & 5 deletions src/zenml/artifacts/artifact_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,18 @@ def _remove_old_attributes(cls, data: Dict[str, Any]) -> Dict[str, Any]:
)
elif is_model_artifact:
logger.warning(
"`ArtifactConfig.is_model_artifact` is deprecated and will be "
"removed soon. Use `ArtifactConfig.artifact_type` instead."
"`ArtifactConfig(..., is_model_artifact=True)` is deprecated "
"and will be removed soon. Use `ArtifactConfig(..., "
"artifact_type=ArtifactType.MODEL)` instead. For more info: "
"https://docs.zenml.io/user-guide/starter-guide/manage-artifacts"
)
data.setdefault("artifact_type", ArtifactType.MODEL)
elif is_deployment_artifact:
logger.warning(
"`ArtifactConfig.is_deployment_artifact` is deprecated and "
"will be removed soon. Use `ArtifactConfig.artifact_type` "
"instead."
"`ArtifactConfig(..., is_deployment_artifact=True)` is "
"deprecated and will be removed soon. Use `ArtifactConfig(..., "
"artifact_type=ArtifactType.SERVICE)` instead. For more info: "
"https://docs.zenml.io/user-guide/starter-guide/manage-artifacts"
)
data.setdefault("artifact_type", ArtifactType.SERVICE)

Expand Down
4 changes: 3 additions & 1 deletion src/zenml/artifacts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,9 @@ def log_artifact_metadata(
"""
logger.warning(
"The `log_artifact_metadata` function is deprecated and will soon be "
"removed. Please use `log_metadata` instead."
"removed. Instead, you can consider using: "
"`log_metadata(metadata={...}, infer_artifact=True, ...)` instead. For more "
"info: https://docs.zenml.io/how-to/model-management-metrics/track-metrics-metadata/attach-metadata-to-an-artifact"
)

from zenml import log_metadata
Expand Down
4 changes: 3 additions & 1 deletion src/zenml/model/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def log_model_metadata(
"""
logger.warning(
"The `log_model_metadata` function is deprecated and will soon be "
"removed. Please use `log_metadata` instead."
"removed. Instead, you can consider using: "
"`log_metadata(metadata={...}, infer_model=True)` instead. For more "
"info: https://docs.zenml.io/how-to/model-management-metrics/track-metrics-metadata/attach-metadata-to-a-model"
)

from zenml import log_metadata
Expand Down

0 comments on commit 96034f9

Please sign in to comment.