瀏覽代碼

feat:添加测试脚本

zhaohaipeng 6 月之前
父節點
當前提交
1d6091278a
共有 1 個文件被更改,包括 16 次插入12 次删除
  1. 16 12
      ad/01_ad_model_update.sh

+ 16 - 12
ad/01_ad_model_update.sh

@@ -76,7 +76,22 @@ check_run_status() {
 }
 
 send_success_upload_msg(){ 
+  # 发送更新成功通知
+  local msg=" 广告模型文件更新完成"
+  msg+="\n\t - 老模型Top10差异平均值: ${old_incr_rate_avg}"
+  msg+="\n\t - 新模型Top10差异平均值: ${new_incr_rate_avg}"
+  msg+="\n\t - 模型在HDFS中的路径: ${model_save_path}"
+  msg+="\n\t - 模型上传OSS中的路径: ${MODEL_OSS_PATH}/${model_name}.tar.gz"
+  
+  local top10_msg="| CID  | 老模型    | 新模型    | \n| ---- | -------- | -------- | "
+  for cid in "${!new_score_map[@]}"; do
+    top10_msg="${top10_msg} \n| ${cid} | ${old_score_map[$cid]} | ${new_score_map[$cid]} | "
+  done
+
+  local step_end_time=$(date +%s)
+  local elapsed=$(($step_end_time - $start_time))
 
+  /root/anaconda3/bin/python ${sh_path}/ad_monitor_util.py --level info --msg "${msg}" --start "${start_time}" --elapsed "${elapsed}" --top10 "${top10_msg}"
 }
 
 init() {
@@ -316,19 +331,8 @@ model_upload_oss() {
   local elapsed=$(($step_end_time - $start_time))
 
   echo -e "$LOG_PREFIX -- 模型更新完成 -- 模型更新成功: 耗时 $elapsed"
-
-  # 发送更新成功通知
-  local msg=" 广告模型文件更新完成"
-  msg+="\n\t - 老模型Top10差异平均值: ${old_incr_rate_avg}"
-  msg+="\n\t - 新模型Top10差异平均值: ${new_incr_rate_avg}"
-  msg+="\n\t - 模型在HDFS中的路径: ${model_save_path}"
-  msg+="\n\t - 模型上传OSS中的路径: ${MODEL_OSS_PATH}/${model_name}.tar.gz"
   
-  local top10_msg="| CID  | 老模型    | 新模型    | \n| ---- | -------- | -------- | "
-  for cid in "${!new_score_map[@]}"; do
-    top10_msg="${top10_msg} \n| ${cid} | ${old_score_map[$cid]} | ${new_score_map[$cid]} | "
-  done
-  /root/anaconda3/bin/python ${sh_path}/ad_monitor_util.py --level info --msg "${msg}" --start "${start_time}" --elapsed "${elapsed}" --top10 "${top10_msg}"
+  send_success_upload_msg
 }
 
 # 主方法