def _get_model_version(): request_message = _get_request_message(GetModelVersion()) model_version = _get_model_registry_store().get_model_version( name=request_message.name, version=request_message.version) response_proto = model_version.to_proto() response_message = GetModelVersion.Response(model_version=response_proto) return _wrap_response(response_message)
def test_get_model_version_details(self, mock_http): name = "model_11" version = "8" self.store.get_model_version(name=name, version=version) self._verify_requests( mock_http, "model-versions/get", "GET", GetModelVersion(name=name, version=version) )
def get_model_version(self, name, version): """ :param name: Registered model name. :param version: Registered model version. :return: A single :py:class:`mlflow.entities.model_registry.ModelVersion` object. """ req_body = message_to_json( GetModelVersion(name=name, version=str(version))) response_proto = self._call_endpoint(GetModelVersion, req_body) return ModelVersion.from_proto(response_proto.model_version)
def test_get_model_version_details(mock_get_request_message, mock_model_registry_store): mock_get_request_message.return_value = GetModelVersion(name="model1", version="32") mvd = ModelVersion(name="model1", version="5", creation_timestamp=1, last_updated_timestamp=12, description="v 5", user_id="u1", current_stage="Production", source="A/B", run_id=uuid.uuid4().hex, status="READY", status_message=None) mock_model_registry_store.get_model_version.return_value = mvd resp = _get_model_version() _, args = mock_model_registry_store.get_model_version.call_args assert args == {"name": "model1", "version": "32"} assert json.loads(resp.get_data()) == {"model_version": jsonify(mvd)}