|
@@ -395,28 +395,23 @@ def h_timer_check():
|
|
|
now_h = datetime.datetime.now().hour
|
|
|
now_min = datetime.datetime.now().minute
|
|
|
if now_h == 0:
|
|
|
- log_.info("当前时间{}小时,使用bottom的data,开始。".format(now_h))
|
|
|
+ log_.info("当前时间{}小时,使用bottom的data合并,开始。".format(now_h))
|
|
|
h_rank_bottom(now_date=now_date, now_h=now_h, rule_params=rule_params, region_code_list=region_code_list,
|
|
|
rule_rank_h_flag=rule_rank_h_flag)
|
|
|
log_.info("----------当前时间{}小时,使用bottom的data,完成----------".format(now_h))
|
|
|
return
|
|
|
# 查看当前小时更新的数据是否已准备好
|
|
|
- h_data_count = h_data_check(project=project, table=table, now_date=now_date)
|
|
|
- if h_data_count > 0:
|
|
|
- log_.info('上游数据表查询数据条数 h_data_count = {},开始计算。'.format(h_data_count))
|
|
|
+ if now_min < 45:
|
|
|
+ log_.info('开始正常合并')
|
|
|
# 数据准备好,进行更新
|
|
|
rank_by_h(now_date=now_date, now_h=now_h, rule_params=rule_params,
|
|
|
project=project, table=table, region_code_list=region_code_list, rule_rank_h_flag=rule_rank_h_flag)
|
|
|
log_.info("----------正常完成----------")
|
|
|
- elif now_min > 40:
|
|
|
- log_.info('当前分钟超过40,预计执行无法完成,使用 bottom data!')
|
|
|
+ else:
|
|
|
+ log_.info('当前合并分钟超过45,预计执行无法完成,使用 bottom data!')
|
|
|
h_rank_bottom(now_date=now_date, now_h=now_h, rule_params=rule_params, region_code_list=region_code_list,
|
|
|
rule_rank_h_flag=rule_rank_h_flag)
|
|
|
- log_.info('----------当前分钟超过40,使用bottom的data,完成----------')
|
|
|
- else:
|
|
|
- # 数据没准备好,1分钟后重新检查
|
|
|
- Timer(60, h_timer_check).start()
|
|
|
-
|
|
|
+ log_.info('----------当前分钟超过45,使用bottom的data,完成----------')
|
|
|
except Exception as e:
|
|
|
log_.error(f"地域分组小时级数据更新失败, exception: {e}, traceback: {traceback.format_exc()}")
|
|
|
send_msg_to_feishu(
|
|
@@ -429,5 +424,5 @@ def h_timer_check():
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- log_.info("文件alg_recsys_recall_aftermerge.py:「去重」 开始执行")
|
|
|
+ log_.info("文件alg_recsys_recall_aftermerge.py:「去重合并」 开始执行")
|
|
|
h_timer_check()
|