#24 修改DNN模型自动更新脚本全局变量

マージされた
fengzhoutian 4 日 前 に 3 件のコミットが algorithm/dev-xym-update から algorithm/feature/20250104-zt-update にマージされました
1 ファイル変更9 行追加4 行削除
  1. 9 4
      ad/pai_flow_operator2.py

+ 9 - 4
ad/pai_flow_operator2.py

@@ -387,13 +387,16 @@ def extract_date_yyyymmdd(input_string):
     return None
 
 
-def get_online_version_dt(service_name: str):
+def get_online_model_config(service_name: str):
+    model_config = {}
     model_detail = PAIClient.get_describe_service(service_name)
     service_config_str = model_detail['ServiceConfig']
     service_config = json.loads(service_config_str)
     model_path = service_config['model_path']
+    model_config['model_path'] = model_path
     online_date = extract_date_yyyymmdd(model_path)
-    return online_date
+    model_config['online_date'] = online_date
+    return model_config
 
 
 
@@ -493,7 +496,7 @@ def get_job_dict():
 @retry
 def update_online_flow():
     try:
-        online_version_dt = get_online_version_dt('ad_rank_dnn_v11_easyrec')
+        online_model_config = get_online_model_config('ad_rank_dnn_v11_easyrec')
         draft = PAIClient.get_work_flow_draft(experiment_id)
         print(json.dumps(draft, ensure_ascii=False))
         content = draft['Content']
@@ -508,9 +511,11 @@ def update_online_flow():
                 if global_param['name'] == 'bizdate':
                     global_param['value'] = bizdate
                 if global_param['name'] == 'online_version_dt':
-                    global_param['value'] = online_version_dt
+                    global_param['value'] = online_model_config['online_date']
                 if global_param['name'] == 'eval_date':
                     global_param['value'] = bizdate
+                if global_param['name'] == 'online_model_path':
+                    global_param['value'] = online_model_config['model_path']
             except KeyError:
                 raise Exception("在处理全局参数时,字典中缺少必要的键")
         for node in nodes: