added the featuregroup service layer and change status service for tj 88/13788/1
authorrajdeep11 <rajdeep.sin@samsung.com>
Wed, 27 Nov 2024 10:32:55 +0000 (16:02 +0530)
committerrajdeep11 <rajdeep.sin@samsung.com>
Wed, 27 Nov 2024 10:32:55 +0000 (16:02 +0530)
Change-Id: I0cef5acc7323575c4fbb6f859aff31d12a9aee18
Signed-off-by: rajdeep11 <rajdeep.sin@samsung.com>
trainingmgr/service/featuregroup_service.py [new file with mode: 0644]
trainingmgr/service/training_job_service.py

diff --git a/trainingmgr/service/featuregroup_service.py b/trainingmgr/service/featuregroup_service.py
new file mode 100644 (file)
index 0000000..3c0a354
--- /dev/null
@@ -0,0 +1,31 @@
+# ==================================================================================
+#
+#       Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved.
+#
+#   Licensed 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 trainingmgr.db.featuregroup_db import get_feature_group_by_name_db
+from trainingmgr.common.exceptions_utls import TMException, DBException
+from trainingmgr.common.trainingmgr_config import TrainingMgrConfig
+
+LOGGER = TrainingMgrConfig().logger
+
+def get_featuregroup_by_name(featuregroup_name:str):
+    LOGGER.debug(f'service for get featuregroup by name')
+    try:
+        featuregroup = get_feature_group_by_name_db(featuregroup_name)
+        return featuregroup
+    except DBException as err:
+        raise TMException(f"get featuregroup by name service failed with exception : {str(err)}") 
\ No newline at end of file
index 8c7dcfd..975888e 100644 (file)
@@ -15,7 +15,8 @@
 #   limitations under the License.
 #
 # ==================================================================================
-from trainingmgr.db.trainingjob_db import delete_trainingjob_by_id, create_trainingjob, get_trainingjob, get_trainingjob_by_modelId_db
+from trainingmgr.db.trainingjob_db import delete_trainingjob_by_id, create_trainingjob, get_trainingjob, get_trainingjob_by_modelId_db, \
+change_steps_state
 from trainingmgr.common.exceptions_utls import DBException, TMException
 from trainingmgr.schemas import TrainingJobSchema
 
@@ -78,3 +79,8 @@ def get_steps_state(trainingjob_id):
     except Exception as err:
         raise DBException(f"get failed to get the status with exception : {str(err)}") 
 
+def change_status_tj(trainingjob, step:str, state:str):
+    try:
+        change_steps_state(trainingjob, step, state)
+    except DBException as err:
+        raise TMException(f"change status of tj failed with exception : {str(err)}")
\ No newline at end of file