|
@@ -257,10 +257,11 @@ def update_single_day(dt, account_list, article_df, lam):
|
|
|
"""
|
|
|
index_list = [1, 2, 3, 4, 5, 6, 7, 8]
|
|
|
error_list = []
|
|
|
+ insert_error_list = []
|
|
|
for account in tqdm(account_list):
|
|
|
for index in index_list:
|
|
|
- avg_rate, max_time, min_time, a_count = cal_avg_account_read_rate(article_df, account['gh_id'], index, dt)
|
|
|
- if a_count > 0:
|
|
|
+ avg_rate, max_time, min_time, articles_count = cal_avg_account_read_rate(article_df, account['gh_id'], index, dt)
|
|
|
+ if articles_count > 0:
|
|
|
if index in {1, 2}:
|
|
|
error_obj = check_each_position(
|
|
|
db_client=lam,
|
|
@@ -289,7 +290,7 @@ def update_single_day(dt, account_list, article_df, lam):
|
|
|
index,
|
|
|
avg_rate,
|
|
|
"从 {} 开始往前计算 31 天".format(dt),
|
|
|
- a_count,
|
|
|
+ articles_count,
|
|
|
timestamp_to_str(min_time),
|
|
|
timestamp_to_str(max_time),
|
|
|
dt.replace("-", ""),
|
|
@@ -297,7 +298,14 @@ def update_single_day(dt, account_list, article_df, lam):
|
|
|
)
|
|
|
)
|
|
|
except Exception as e:
|
|
|
- print(e)
|
|
|
+ insert_error_list.append(e)
|
|
|
+
|
|
|
+ if insert_error_list:
|
|
|
+ bot(
|
|
|
+ title="更新阅读率均值,存在sql 插入失败",
|
|
|
+ detail=insert_error_list
|
|
|
+ )
|
|
|
+
|
|
|
if error_list:
|
|
|
bot(
|
|
|
title="更新阅读率均值,头次出现异常值通知",
|