Quellcode durchsuchen

feat:添加分析任务

zhaohaipeng vor 10 Monaten
Ursprung
Commit
ea8502c5f3
1 geänderte Dateien mit 4 neuen und 5 gelöschten Zeilen
  1. 4 5
      feature_spark_monitor.py

+ 4 - 5
feature_spark_monitor.py

@@ -119,11 +119,6 @@ def _main():
     # 获取最近七小时的Spark任务
     hours_7_early = int((datetime.now() - timedelta(hours=7)).timestamp()) * 1000
     result = yarn_client.get_apps(finished_time_begin=hours_7_early)
-
-    if len(result) == 0:
-        print("未获取到数据,跳过本次告警")
-        return
-
     result = [
         {**item, 'name': item['name'].split(":")[1].strip()}
         for item in result
@@ -131,6 +126,10 @@ def _main():
 
     ]
 
+    if len(result) == 0:
+        print("未获取到数据,跳过本次告警")
+        return
+
     for table_name in table_list:
         # 判断最后一次同步是否为两个小时以内
         b, latest_started_time = handle_table(table_name, result)