Bug Fixes. 63/10063/1
authorsmahana123 <s.mahana@samsung.com>
Mon, 12 Dec 2022 11:00:01 +0000 (16:30 +0530)
committersmahana123 <s.mahana@samsung.com>
Mon, 12 Dec 2022 11:02:41 +0000 (16:32 +0530)
Issue-Id: AIMLFW-6

Signed-off-by: smahana123 <s.mahana@samsung.com>
Change-Id: I260d932280636b9ab14aef0aa1cc2a87c071e98b

tests/test_common_db_fun.py
trainingmgr/common/trainingmgr_operations.py
trainingmgr/trainingmgr_main.py

index 3f12089..77a054f 100644 (file)
@@ -118,14 +118,14 @@ class Test_Common_Db_Fun:
         
         assert out != None, 'Function get_data_extraction_in_progress_trainingjobs has failed'
     
-    def test_get_data_extraction_in_progress_trainingjobs(self):
+    def test_negative_get_data_extraction_in_progress_trainingjobs(self):
         checker = Check()
         try:
             db_obj = db_helper([["usecase_name", "steps_state"]], raise_exception=True, check_success_obj=checker)
             out = get_data_extraction_in_progress_trainingjobs(db_obj)
             assert out != None, 'Fxn get_usecases_which_has_data_extraction_in_progress Failed'
         except Exception as err:
-            assert str(err) == "bad operand type for unary +: 'str'", 'Negative test get_usecases_which_has_data_extraction_in_progress FAILED, Doesnt returned required error'
+            assert str(err) == "Failed to execute query in get_data_extraction_in_progress_trainingjobs,DB Error", 'Negative test get_usecases_which_has_data_extraction_in_progress FAILED, Doesnt returned required error'
             assert checker.finished, 'Cursor Not Closed Properly for fxn test_negative_get_usecases_which_has_data_extraction_in_progress'
 
     def test_change_field_of_latest_version(self):
@@ -209,7 +209,7 @@ class Test_Common_Db_Fun:
             assert checker.finished, 'change_in_progress_to_failed_by_latest_version FAILED'
         except Exception as err:
                 fxn_name = "change_in_progress_to_failed_by_latest_version("
-                assert str(err) == "bad operand type for unary +: 'str'", 'Negative test {} FAILED, Doesnt returned required error'.format(fxn_name)
+                assert str(err) == "Failed to execute query in change_in_progress_to_failed_by_latest_versionDB Error", 'Negative test {} FAILED, Doesnt returned required error'.format(fxn_name)
                 assert checker.finished, 'Cursor Not Closed Properly for fxn {} | Negative Test'.format(fxn_name)
 
     def test_change_steps_state_of_latest_version(self):
index 29a626b..a258f1a 100644 (file)
@@ -24,6 +24,7 @@ Training manager main operations
 import json
 import requests
 
+str_ing = 'http://'
 def data_extraction_start(training_config_obj, trainingjob_name, feature_list, query_filter,
                           datalake_source, _measurement, bucket):
     """
@@ -34,7 +35,7 @@ def data_extraction_start(training_config_obj, trainingjob_name, feature_list, q
     logger.debug('training manager is calling data extraction for '+trainingjob_name)
     data_extraction_ip = training_config_obj.data_extraction_ip
     data_extraction_port = training_config_obj.data_extraction_port
-    url = 'http://'+str(data_extraction_ip)+':'+str(data_extraction_port)+'/feature-groups'
+    url = str_ing+str(data_extraction_ip)+':'+str(data_extraction_port)+'/feature-groups'
     logger.debug(url)
 
     source = {}
@@ -84,7 +85,7 @@ def data_extraction_status(trainingjob_name,training_config_obj):
     logger.debug('training manager is calling data extraction for '+trainingjob_name)
     data_extraction_ip = training_config_obj.data_extraction_ip
     data_extraction_port = training_config_obj.data_extraction_port
-    url = 'http://'+str(data_extraction_ip)+':'+str(data_extraction_port)+\
+    url = str_ing+str(data_extraction_ip)+':'+str(data_extraction_port)+\
           '/task-status/'+trainingjob_name
     logger.debug(url)
     response = requests.get(url)
@@ -100,7 +101,7 @@ def training_start(training_config_obj, dict_data, trainingjob_name):
     logger.debug('training manager will send to kf_adapter: '+json.dumps(dict_data))
     kf_adapter_ip = training_config_obj.kf_adapter_ip
     kf_adapter_port = training_config_obj.kf_adapter_port
-    url = 'http://'+str(kf_adapter_ip)+':'+str(kf_adapter_port)+\
+    url = str_ing+str(kf_adapter_ip)+':'+str(kf_adapter_port)+\
             '/trainingjobs/' + trainingjob_name + '/execution'
     logger.debug(url)
     response = requests.post(url,
index 3e629ce..8c45003 100644 (file)
@@ -872,7 +872,6 @@ def trainingjob_operations(trainingjob_name):
         All exception are provided with exception message and HTTP status code.
     """
     api_response = {}
-    #response_code = status.HTTP_500_INTERNAL_SERVER_ERROR
     response_code = status.HTTP_500_INTERNAL_SERVER_ERROR
     LOGGER.debug("Training job create/update request(trainingjob name  %s) ", trainingjob_name )
     try: