Browse Source

Update update_online_dnn_version

StrayWarrior 1 day ago
parent
commit
9622ce60d3
1 changed files with 6 additions and 11 deletions
  1. 6 11
      ad/update_online_dnn_version.py

+ 6 - 11
ad/update_online_dnn_version.py

@@ -50,12 +50,10 @@ class EASClient:
                                                      headers, runtime)
             return res
         except Exception as error:
-            # 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
-            # 错误 message
             print(error.message)
             # 诊断地址
             print(error.data.get("Recommend"))
-            UtilClient.assert_as_string(error.message)
+            raise error
 
     @staticmethod
     def get_online_model_detail():
@@ -63,16 +61,13 @@ class EASClient:
         runtime = util_models.RuntimeOptions()
         headers = {}
         try:
-            # 复制代码运行请自行打印 API 的返回值
             res =  client.describe_service_with_options('cn-hangzhou', SERVICE_NAME, headers, runtime)
             return res.body.to_map()
         except Exception as error:
-            # 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
-            # 错误 message
             print(error.message)
             # 诊断地址
             print(error.data.get("Recommend"))
-            UtilClient.assert_as_string(error.message)
+            raise error
 
 
 def exist_oss_directory_path(directory_path):
@@ -137,11 +132,11 @@ def update_online_dnn_version(model_name: str, dt: str):
         print(json.dumps(model_path_config))
         online_model_update_res = EASClient.update_online_model_path(json.dumps(model_path_config))
         if online_model_update_res.status_code == 200:
-            time.sleep(60)
-            status = EASClient.get_online_model_detail()['Status']
-            while status != 'Running':
-                time.sleep(60)
+            while True:
+                time.sleep(15)
                 status = EASClient.get_online_model_detail()['Status']
+                if status == 'Running':
+                    break
             cid_update_res = update_trained_cids_pointer(model_name, dt)
             if cid_update_res.status_code == 200:
                 print('模型更新成功,cid配置更新成功')