You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by ku...@apache.org on 2021/12/04 05:22:34 UTC

[submarine] branch master updated: SUBMARINE-1113. Incorrect model version name in SDK

This is an automated email from the ASF dual-hosted git repository.

kuanhsun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new 5c29b3a  SUBMARINE-1113. Incorrect model version name in SDK
5c29b3a is described below

commit 5c29b3a3b7d7c32600071810c7e35408c8722f0d
Author: jeff-901 <b0...@ntu.edu.tw>
AuthorDate: Sat Dec 4 08:52:05 2021 +0800

    SUBMARINE-1113. Incorrect model version name in SDK
    
    ### What is this PR for?
    Change ModelMetadata to ModelVersion in SDK.
    
    ### What type of PR is it?
    Bug Fix
    
    ### Todos
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/SUBMARINE-1113
    
    ### How should this be tested?
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Do the license files need updating? No
    * Are there breaking changes for older versions? No
    * Does this need new documentation? No
    
    Author: jeff-901 <b0...@ntu.edu.tw>
    
    Signed-off-by: kuanhsun <ku...@apache.org>
    
    Closes #815 from jeff-901/SUBMARINE-1113 and squashes the following commits:
    
    1601e3d4 [jeff-901] fix typo
    f9e194ce [jeff-901] update MmodelMetadata to ModelVersion
---
 submarine-sdk/pysubmarine/submarine/store/database/models.py   | 10 +++++-----
 .../submarine/store/model_registry/abstract_store.py           |  2 +-
 .../submarine/store/model_registry/sqlalchemy_store.py         |  8 ++++----
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/submarine-sdk/pysubmarine/submarine/store/database/models.py b/submarine-sdk/pysubmarine/submarine/store/database/models.py
index 70bb75e..8f2f587 100644
--- a/submarine-sdk/pysubmarine/submarine/store/database/models.py
+++ b/submarine-sdk/pysubmarine/submarine/store/database/models.py
@@ -86,7 +86,7 @@ class SqlRegisteredModel(Base):
         "SqlModelVersion", back_populates="registered_model", cascade="all"
     )
     """
-    Metadatas reference to SqlRegisteredModel
+    ModelVersions reference to SqlRegisteredModel
     """
 
     __table_args__ = (PrimaryKeyConstraint("name", name="model_pk"),)
@@ -243,7 +243,7 @@ class SqlModelVersion(Base):
 
     def __repr__(self):
         return (
-            f"<SqlModelMetadata ({self.name}, {self.version}, {self.source}, {self.user_id},"
+            f"<SqlModelVersion ({self.name}, {self.version}, {self.source}, {self.user_id},"
             f" {self.experiment_id}, {self.current_stage}, {self.creation_time},"
             f" {self.last_updated_time}, {self.dataset}, {self.description})>"
         )
@@ -251,7 +251,7 @@ class SqlModelVersion(Base):
     def to_submarine_entity(self):
         """
         Convert DB model to corresponding Submarine entity.
-        :return: :py:class:`submarine.entities.ModelMetadata`.
+        :return: :py:class:`submarine.entities.ModelVersion`.
         """
         return ModelVersion(
             name=self.name,
@@ -285,13 +285,13 @@ class SqlModelVersionTag(Base):
     name = Column(String(256), nullable=False)
     """
     Name of registered model: Part of *Foreign Key* for ``model_version_tag`` table.
-                              Refer to name of ``model_metadata`` table.
+                              Refer to name of ``model_version`` table.
     """
 
     version = Column(Integer, nullable=False)
     """
     version of model: Part of *Foreign Key* for ``model_version_tag`` table.
-                      Refer to version of ``model_metadata`` table.
+                      Refer to version of ``model_version`` table.
     """
 
     tag = Column(String(256), nullable=False)
diff --git a/submarine-sdk/pysubmarine/submarine/store/model_registry/abstract_store.py b/submarine-sdk/pysubmarine/submarine/store/model_registry/abstract_store.py
index a06ed99..b0344f9 100644
--- a/submarine-sdk/pysubmarine/submarine/store/model_registry/abstract_store.py
+++ b/submarine-sdk/pysubmarine/submarine/store/model_registry/abstract_store.py
@@ -143,7 +143,7 @@ class AbstractStore:
         :param dataset: Dataset which this version of model is used.
         :param description: Description of this version.
         :param tags: A list of string associated with this version of model.
-        :return: A single object of :py:class:`submarine.entities.model_registry.ModelMetadata`
+        :return: A single object of :py:class:`submarine.entities.model_registry.ModelVersion`
                  created in the backend.
         """
         pass
diff --git a/submarine-sdk/pysubmarine/submarine/store/model_registry/sqlalchemy_store.py b/submarine-sdk/pysubmarine/submarine/store/model_registry/sqlalchemy_store.py
index 3825716..a16d358 100644
--- a/submarine-sdk/pysubmarine/submarine/store/model_registry/sqlalchemy_store.py
+++ b/submarine-sdk/pysubmarine/submarine/store/model_registry/sqlalchemy_store.py
@@ -357,7 +357,7 @@ class SqlAlchemyStore(AbstractStore):
         :param dataset: Dataset which this version of model is used.
         :param description: Description of this version.
         :param tags: A list of string associated with this version of model.
-        :return: A single object of :py:class:`submarine.entities.model_registry.ModelMetadata`
+        :return: A single object of :py:class:`submarine.entities.model_registry.ModelVersion`
                  created in the backend.
         """
 
@@ -375,7 +375,7 @@ class SqlAlchemyStore(AbstractStore):
                 creation_time = datetime.now()
                 sql_registered_model = self._get_sql_registered_model(session, name)
                 sql_registered_model.last_updated_time = creation_time
-                model_metadata = SqlModelVersion(
+                model_version = SqlModelVersion(
                     name=name,
                     version=next_version(sql_registered_model),
                     source=source,
@@ -388,9 +388,9 @@ class SqlAlchemyStore(AbstractStore):
                     description=description,
                     tags=[SqlModelVersionTag(tag=tag) for tag in tags or []],
                 )
-                self._save_to_db(session, [sql_registered_model, model_metadata])
+                self._save_to_db(session, [sql_registered_model, model_version])
                 session.flush()
-                return model_metadata.to_submarine_entity()
+                return model_version.to_submarine_entity()
             except sqlalchemy.exc.IntegrityError:
                 raise SubmarineException(f"Model create error (name={name}).")
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org