Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark Model Registry Stages as deprecated #10416

Merged
merged 7 commits into from Nov 17, 2023
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion mlflow/tracking/client.py
Expand Up @@ -37,7 +37,7 @@
from mlflow.tracking._tracking_service.client import TrackingServiceClient
from mlflow.tracking.artifact_utils import _upload_artifacts_to_databricks
from mlflow.tracking.registry import UnsupportedModelRegistryStoreURIException
from mlflow.utils.annotations import experimental
from mlflow.utils.annotations import deprecated, experimental
from mlflow.utils.async_logging.run_operations import RunOperations
from mlflow.utils.databricks_utils import get_databricks_run_url
from mlflow.utils.logging_utils import eprint
Expand All @@ -62,6 +62,11 @@

_logger = logging.getLogger(__name__)

_STAGES_DEPRECATION_WARNING = (
"Model registry stages will be removed in a future major release. To learn more about the "
"deprecation of model registry stages, see https://github.com/mlflow/mlflow/issues/10336"
)


class MlflowClient:
"""
Expand Down Expand Up @@ -2406,6 +2411,7 @@ def print_model_info(rm):
"""
return self._get_registry_client().get_registered_model(name)

@deprecated(since="2.9.0", impact=_STAGES_DEPRECATION_WARNING)
def get_latest_versions(
self, name: str, stages: Optional[List[str]] = None
) -> List[ModelVersion]:
Expand Down Expand Up @@ -2876,6 +2882,7 @@ def print_model_version_info(mv):
name=name, version=version, description=description
)

@deprecated(since="2.9.0", impact=_STAGES_DEPRECATION_WARNING)
def transition_model_version_stage(
self, name: str, version: str, stage: str, archive_existing_versions: bool = False
) -> ModelVersion:
Expand Down Expand Up @@ -3226,6 +3233,7 @@ def search_model_versions(
filter_string, max_results, order_by, page_token
)

@deprecated(since="2.9.0", impact=_STAGES_DEPRECATION_WARNING)
def get_model_version_stages(
self, name: str, version: str
) -> List[str]: # pylint: disable=unused-argument
Expand Down Expand Up @@ -3352,6 +3360,10 @@ def print_model_version_info(mv):
"""
_validate_model_version_or_stage_exists(version, stage)
if stage:
_logger.warning(
"The `stage` parameter of the `set_model_version_tag` API is deprecated. "
+ _STAGES_DEPRECATION_WARNING
)
jerrylian-db marked this conversation as resolved.
Show resolved Hide resolved
latest_versions = self.get_latest_versions(name, stages=[stage])
if not latest_versions:
raise MlflowException(f"Could not find any model version for {stage} stage")
Expand Down Expand Up @@ -3437,6 +3449,10 @@ def print_model_version_info(mv):
"""
_validate_model_version_or_stage_exists(version, stage)
if stage:
_logger.warning(
"The `stage` parameter of the `set_model_version_tag` API is deprecated. "
+ _STAGES_DEPRECATION_WARNING
)
latest_versions = self.get_latest_versions(name, stages=[stage])
if not latest_versions:
raise MlflowException("Could not find any model version for {stage} stage")
Expand Down