From: rajdeep11 Date: Wed, 27 Nov 2024 10:32:55 +0000 (+0530) Subject: added the featuregroup service layer and change status service for tj X-Git-Tag: 3.0.0~25 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=1124307acbef6abdae9af0faa8f2c940cf1be6df;p=aiml-fw%2Fawmf%2Ftm.git added the featuregroup service layer and change status service for tj Change-Id: I0cef5acc7323575c4fbb6f859aff31d12a9aee18 Signed-off-by: rajdeep11 --- diff --git a/trainingmgr/service/featuregroup_service.py b/trainingmgr/service/featuregroup_service.py new file mode 100644 index 0000000..3c0a354 --- /dev/null +++ b/trainingmgr/service/featuregroup_service.py @@ -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 diff --git a/trainingmgr/service/training_job_service.py b/trainingmgr/service/training_job_service.py index 8c7dcfd..975888e 100644 --- a/trainingmgr/service/training_job_service.py +++ b/trainingmgr/service/training_job_service.py @@ -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