|
|
@@ -87,6 +87,7 @@ def job_run_state(start_ts: int, end_ts: int):
|
|
|
|
|
|
|
|
|
def crawler_mode_not_success_warning(start_ts: int, end_ts: int, job_info_list: List[AutomationJobCronInfo]):
|
|
|
+ not_success_job_list = []
|
|
|
for job_info in job_info_list:
|
|
|
crawler_mode = job_info.crawler_mode
|
|
|
video_source = job_info.video_source
|
|
|
@@ -96,14 +97,20 @@ def crawler_mode_not_success_warning(start_ts: int, end_ts: int, job_info_list:
|
|
|
resp = client.get_log(project=project, logstore=log_store, from_time=start_ts, to_time=end_ts, query=query_sql)
|
|
|
success_cnt = int(resp.get_body().get('data')[0]['cnt'])
|
|
|
if success_cnt <= 0:
|
|
|
- msg = f"- 供给方式: {job_name} \n- 视频来源: {video_source} \n- 当天还没有成功执行的任务,请关注"
|
|
|
- new_card_json = {**card_json, **{}}
|
|
|
- new_card_json['header']['template'] = 'red'
|
|
|
- new_card_json['body']['elements'] = [{
|
|
|
- "tag": "markdown",
|
|
|
- "content": msg
|
|
|
- }]
|
|
|
- feishu_inform_util.send_card_msg_to_feishu(webhook, card_json)
|
|
|
+ not_success_job_list.append(job_name)
|
|
|
+
|
|
|
+ if not_success_job_list:
|
|
|
+ msg = f"以下任务当天还没有成功执行的任务,请关注"
|
|
|
+ for job in not_success_job_list:
|
|
|
+ msg += f"\n - {job}"
|
|
|
+
|
|
|
+ new_card_json = {**card_json, **{}}
|
|
|
+ new_card_json['header']['template'] = 'red'
|
|
|
+ new_card_json['body']['elements'] = [{
|
|
|
+ "tag": "markdown",
|
|
|
+ "content": msg
|
|
|
+ }]
|
|
|
+ feishu_inform_util.send_card_msg_to_feishu(webhook, card_json)
|
|
|
|
|
|
|
|
|
def main():
|