Browse Source

Update pai_flow_operator2: fix type

fengzhoutian 3 weeks ago
parent
commit
07d5e57f40
1 changed files with 10 additions and 10 deletions
  1. 10 10
      ad/pai_flow_operator2.py

+ 10 - 10
ad/pai_flow_operator2.py

@@ -101,14 +101,14 @@ def get_dates_between(start_date_str, end_date_str):
 def read_file_to_list():
     try:
         current_dir = os.getcwd()
-        file_path = os.path.join(current_dir, 'holidays.txt')
+        file_path = os.path.join(current_dir, 'ad', 'holidays.txt')
         with open(file_path, 'r', encoding='utf-8') as file:
             content = file.read()
             return content.split('\n')
     except FileNotFoundError:
-        print(f"错误:未找到 {file_path} 文件。")
+        raise Exception(f"错误:未找到 {file_path} 文件。")
     except Exception as e:
-        print(f"错误:发生了一个未知错误: {e}")
+        raise Exception(f"错误:发生了一个未知错误: {e}")
     return []
 
 
@@ -546,26 +546,26 @@ def validate_model_data_accuracy(start_time):
         node_id = validate_job_detail['PaiflowNodeId']
         flow_out_put_detail = PAIClient.get_flow_out_put(pipeline_run_id, node_id, 3)
         print(flow_out_put_detail)
-        tabel_dict = {}
+        table_dict = {}
         out_puts = flow_out_put_detail['Outputs']
         for out_put in out_puts:
             if out_put["Producer"] == node_dict['二分类评估-1'] and out_put["Name"] == "outputMetricTable":
                 value1 = json.loads(out_put["Info"]['value'])
-                tabel_dict['二分类评估-1'] = value1['location']['table']
+                table_dict['二分类评估-1'] = value1['location']['table']
             if out_put["Producer"] == node_dict['二分类评估-2'] and out_put["Name"] == "outputMetricTable":
                 value2 = json.loads(out_put["Info"]['value'])
-                tabel_dict['二分类评估-2'] = value2['location']['table']
+                table_dict['二分类评估-2'] = value2['location']['table']
             if out_put["Producer"] == node_dict['预测结果对比'] and out_put["Name"] == "outputTable":
                 value3 = json.loads(out_put["Info"]['value'])
-                tabel_dict['预测结果对比'] = value3['location']['table']
+                table_dict['预测结果对比'] = value3['location']['table']
 
         num = 10
-        df = get_data_from_odps('pai_algo', tabel_dict['预测结果对比'], 10)
+        df = get_data_from_odps('pai_algo', table_dict['预测结果对比'], 10)
         # 对指定列取绝对值再求和
         old_abs_avg = df['old_error'].abs().sum() / num
         new_abs_avg = df['new_error'].abs().sum() / num
-        new_auc = get_dict_from_odps('pai_algo', tabel_dict['二分类评估-1'])['AUC']
-        old_auc = get_dict_from_odps('pai_algo', tabel_dict['二分类评估-2'])['AUC']
+        new_auc = get_dict_from_odps('pai_algo', table_dict['二分类评估-1'])['AUC']
+        old_auc = get_dict_from_odps('pai_algo', table_dict['二分类评估-2'])['AUC']
         bizdate = get_previous_days_date(1)
         score_diff = abs(old_abs_avg - new_abs_avg)
         msg = ""