@@ -119,6 +119,11 @@ 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