This repository has been archived by the owner on Jul 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SUBMARINE-1023. Submarine SDK sqlalchemy store (model registry)
### What is this PR for? * Implement the model registry SQL method in Python SDK * Apply sqlalchemy mypy checks * Replace submarine tracking_uri with db_uri ### What type of PR is it? [Feature] ### Todos ### What is the Jira issue? https://issues.apache.org/jira/browse/SUBMARINE-1023 ### How should this be tested? All of the tests are provided in `submarine-sdk/pysubmarine/tests/store/model_registry/test_sqlalchemy_store.py` ### 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: KUAN-HSUN-LI <[email protected]> Signed-off-by: Kevin <[email protected]> Closes #752 from KUAN-HSUN-LI/SUBMARINE-1023 and squashes the following commits: 7723788 [KUAN-HSUN-LI] SUBMARINE-1023. Submarine model registry Python SDK 5e086b5 [KUAN-HSUN-LI] fix 8c6574d [KUAN-HSUN-LI] fix dd41039 [KUAN-HSUN-LI] replace tacking_uri with db_uri ad9c5d7 [KUAN-HSUN-LI] add init file 374aa2d [KUAN-HSUN-LI] SUBMARINE-1023. Submarine model registry Python SDK b502fc1 [KUAN-HSUN-LI] SUBMARINE-1023. sqlalchemy store tests 343780f [KUAN-HSUN-LI] apply sqlalchmy mypy
- Loading branch information
1 parent
61933c6
commit 4e4cfd9
Showing
33 changed files
with
1,976 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ types-requests==2.25.6 | |
types-certifi==2020.4.0 | ||
types-six==1.16.1 | ||
types-python-dateutil==2.8.0 | ||
sqlalchemy[mypy] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
submarine-sdk/pysubmarine/submarine/entities/model_registry/model_stages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from submarine.exceptions import SubmarineException | ||
|
||
STAGE_NONE = "None" | ||
STAGE_DEVELOPING = "Developing" | ||
STAGE_PRODUCTION = "Production" | ||
STAGE_ARCHIVED = "Archived" | ||
|
||
STAGE_DELETED_INTERNAL = "Deleted_Internal" | ||
|
||
ALL_STAGES = [STAGE_NONE, STAGE_DEVELOPING, STAGE_PRODUCTION, STAGE_ARCHIVED] | ||
_CANONICAL_MAPPING = {stage.lower(): stage for stage in ALL_STAGES} | ||
|
||
|
||
def get_canonical_stage(stage): | ||
key = stage.lower() | ||
if key not in _CANONICAL_MAPPING: | ||
raise SubmarineException(f"Invalid Model Version stage {stage}.") | ||
return _CANONICAL_MAPPING[key] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,5 +26,5 @@ def __init__(self, tag): | |
|
||
@property | ||
def tag(self): | ||
"""String tag.""" | ||
"""String tag""" | ||
return self._tag |
Oops, something went wrong.