| 
														
															@@ -53,6 +53,10 @@ predict_analyse_file_path="" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 # 保存模型评估的分析结果 
														 | 
														
														 | 
														
															 # 保存模型评估的分析结果 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 old_incr_rate_avg=0 
														 | 
														
														 | 
														
															 old_incr_rate_avg=0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 new_incr_rate_avg=0 
														 | 
														
														 | 
														
															 new_incr_rate_avg=0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+top10_msg="" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 declare -A real_score_map 
														 | 
														
														 | 
														
															 declare -A real_score_map 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 declare -A old_score_map 
														 | 
														
														 | 
														
															 declare -A old_score_map 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 declare -A new_score_map 
														 | 
														
														 | 
														
															 declare -A new_score_map 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -70,7 +74,7 @@ check_run_status() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     if [ $status -ne 0 ]; then 
														 | 
														
														 | 
														
															     if [ $status -ne 0 ]; then 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         echo "$LOG_PREFIX -- ${step_name}失败: 耗时 $step_elapsed" 
														 | 
														
														 | 
														
															         echo "$LOG_PREFIX -- ${step_name}失败: 耗时 $step_elapsed" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         local elapsed=$(($step_end_time - $start_time)) 
														 | 
														
														 | 
														
															         local elapsed=$(($step_end_time - $start_time)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        /root/anaconda3/bin/python ${sh_path}/ad_monitor_util.py --level error --msg "$msg" --start "$start_time" --elapsed "$elapsed" 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        /root/anaconda3/bin/python ${sh_path}/ad_monitor_util.py --level error --msg "$msg" --start "$start_time" --elapsed "$elapsed" --top10 "${top10_msg}" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         exit 1 
														 | 
														
														 | 
														
															         exit 1 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     else 
														 | 
														
														 | 
														
															     else 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         echo "$LOG_PREFIX -- ${step_name}成功: 耗时 $step_elapsed" 
														 | 
														
														 | 
														
															         echo "$LOG_PREFIX -- ${step_name}成功: 耗时 $step_elapsed" 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -84,13 +88,6 @@ send_success_upload_msg(){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   msg+="\n\t - 新模型Top10差异平均值: ${new_incr_rate_avg}" 
														 | 
														
														 | 
														
															   msg+="\n\t - 新模型Top10差异平均值: ${new_incr_rate_avg}" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   msg+="\n\t - 模型在HDFS中的路径: ${model_save_path}" 
														 | 
														
														 | 
														
															   msg+="\n\t - 模型在HDFS中的路径: ${model_save_path}" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   msg+="\n\t - 模型上传OSS中的路径: ${MODEL_OSS_PATH}/${model_name}.tar.gz" 
														 | 
														
														 | 
														
															   msg+="\n\t - 模型上传OSS中的路径: ${MODEL_OSS_PATH}/${model_name}.tar.gz" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-   
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  local top10_msg="| CID  | 老模型相对真实CTCVR的变化 | 新模型相对真实CTCVR的变化 |" 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    top10_msg+=" \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 step_end_time=$(date +%s) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   local elapsed=$(($step_end_time - $start_time)) 
														 | 
														
														 | 
														
															   local elapsed=$(($step_end_time - $start_time)) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -98,6 +95,8 @@ send_success_upload_msg(){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   /root/anaconda3/bin/python ${sh_path}/ad_monitor_util.py --level info --msg "${msg}" --start "${start_time}" --elapsed "${elapsed}" --top10 "${top10_msg}" 
														 | 
														
														 | 
														
															   /root/anaconda3/bin/python ${sh_path}/ad_monitor_util.py --level info --msg "${msg}" --start "${start_time}" --elapsed "${elapsed}" --top10 "${top10_msg}" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 init() { 
														 | 
														
														 | 
														
															 init() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															    
														 | 
														
														 | 
														
															    
														 | 
													
												
											
												
													
														| 
														 | 
														
															   declare -a date_keys=() 
														 | 
														
														 | 
														
															   declare -a date_keys=() 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -223,6 +222,8 @@ calc_model_predict() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   local max_line=10 
														 | 
														
														 | 
														
															   local max_line=10 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   local old_total_diff=0 
														 | 
														
														 | 
														
															   local old_total_diff=0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   local new_total_diff=0 
														 | 
														
														 | 
														
															   local new_total_diff=0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  top10_msg="| CID  | 老模型相对真实CTCVR的变化 | 新模型相对真实CTCVR的变化 |" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  top10_msg+=" \n| ---- | --------- | -------- |" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   while read -r line && [ ${count} -lt ${max_line} ]; do 
														 | 
														
														 | 
														
															   while read -r line && [ ${count} -lt ${max_line} ]; do 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															       # 使用 ! 取反判断,只有当行中不包含 "cid" 时才执行继续的逻辑 
														 | 
														
														 | 
														
															       # 使用 ! 取反判断,只有当行中不包含 "cid" 时才执行继续的逻辑 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -237,6 +238,9 @@ calc_model_predict() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       old_score_map[${numbers[0]}]=${numbers[6]} 
														 | 
														
														 | 
														
															       old_score_map[${numbers[0]}]=${numbers[6]} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       new_score_map[${numbers[0]}]=${numbers[7]} 
														 | 
														
														 | 
														
															       new_score_map[${numbers[0]}]=${numbers[7]} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      # 拼接Top10详情的飞书消息 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      top10_msg="${top10_msg} \n| ${numbers[0]} | ${numbers[6]} | ${numbers[7]} | " 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       old_total_diff=$( echo "${old_total_diff} + ${numbers[6]}" | bc -l ) 
														 | 
														
														 | 
														
															       old_total_diff=$( echo "${old_total_diff} + ${numbers[6]}" | bc -l ) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       new_total_diff=$( echo "${new_total_diff} + ${numbers[7]}" | bc -l ) 
														 | 
														
														 | 
														
															       new_total_diff=$( echo "${new_total_diff} + ${numbers[7]}" | bc -l ) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -297,6 +301,16 @@ model_predict() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     check_run_status 1 $step_start_time "${predict_date_path: -8}的数据,绝对误差大于0.1" "线上模型评估${predict_date_path: -8}的数据,绝对误差大于0.1,请检查" 
														 | 
														
														 | 
														
															     check_run_status 1 $step_start_time "${predict_date_path: -8}的数据,绝对误差大于0.1" "线上模型评估${predict_date_path: -8}的数据,绝对误差大于0.1,请检查" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     exit 1 
														 | 
														
														 | 
														
															     exit 1 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   fi  
														 | 
														
														 | 
														
															   fi  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  # 对比两个模型的差异 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  score_diff=$( echo "${new_incr_rate_avg} - ${old_incr_rate_avg}" | bc -l ) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  if (( $(echo "${score_diff} > 0.050000" | bc -l ) ));then  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    echo "两个模型评估${predict_date_path: -8}的数据,两个模型分数差异为: ${score_diff}, 大于0.05, 请检查" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    check_run_status 1 $step_start_time "两个模型评估${predict_date_path: -8}的数据" "两个模型评估${predict_date_path: -8}的数据,两个模型分数差异为: ${score_diff}, 大于0.05" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    exit 1 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  fi  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 model_upload_oss() { 
														 | 
														
														 | 
														
															 model_upload_oss() { 
														 |