def to_detail_entity(self): latest_version = None for model_version in reversed(self.model_version): if model_version.current_stage != STAGE_DELETED: latest_version = model_version.to_meta_entity() break return RegisteredModelDetail(self.model_name, self.model_type, self.model_desc, latest_version)
def to_detail_entity(self): # SqlRegisteredModel has backref to all "model_version". Filter latest version of registered model. latest_version = None for model_version in reversed(self.model_version): if model_version.current_stage != STAGE_DELETED: latest_version = model_version.to_meta_entity() break return RegisteredModelDetail(self.model_name, self.model_type, self.model_desc, latest_version)
def to_meta_entity(self): return RegisteredModelDetail(self.model_name, self.model_type, self.model_desc)