|
@@ -187,7 +187,7 @@ def cal_score_initial(df, param, now_h):
|
|
|
|
|
|
df = df.fillna(0)
|
|
|
# zhangbo
|
|
|
- if now_h in [1,2,3,4]:
|
|
|
+ if now_h in [1,2,3,4,5]:
|
|
|
df['log_back'] = (df['lastonehour_allreturn'] + 1).apply(math.log)
|
|
|
df['share_rate'] = (df['lastonehour_share'] + 1) / (df['lastonehour_play'] + 1000)
|
|
|
df['back_rate'] = (df['lastonehour_return'] + 1) / (df['lastonehour_share'] + 10)
|
|
@@ -199,7 +199,7 @@ def cal_score_initial(df, param, now_h):
|
|
|
if param.get('view_type', None) == 'video-show':
|
|
|
df['ctr'] = df['lastonehour_play'] / (df['lastonehour_show'] + 1000)
|
|
|
elif param.get('view_type', None) == 'video-show-region':
|
|
|
- if now_h in [1, 2, 3, 4]:
|
|
|
+ if now_h in [1, 2, 3, 4,5]:
|
|
|
df['ctr'] = (df['lastonehour_play'] + 1) / (df['lastonehour_show_region'] + 1000)
|
|
|
else:
|
|
|
df['ctr'] = df['lastonehour_play'] / (df['lastonehour_show_region'] + 1000)
|
|
@@ -647,7 +647,7 @@ def video_rank(df, now_date, now_h, rule_key, param, region, data_key, rule_rank
|
|
|
score_value = param.get('score_rule', 0)
|
|
|
platform_return_rate = param.get('platform_return_rate', 0)
|
|
|
# zhangbo
|
|
|
- if now_h in [1, 2, 3, 4] and 'lastonehour_allreturn' in df.columns:
|
|
|
+ if now_h in [1, 2, 3, 4,5] and 'lastonehour_allreturn' in df.columns:
|
|
|
h_recall_df = df[
|
|
|
(df['lastonehour_return'] > 0) |
|
|
|
(df['lastonehour_allreturn'] > 1)
|
|
@@ -1125,17 +1125,17 @@ def h_timer_check():
|
|
|
now_h = datetime.datetime.now().hour
|
|
|
now_min = datetime.datetime.now().minute
|
|
|
redis_helper = RedisHelper()
|
|
|
- if now_h == 0:
|
|
|
- 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(f"region_h_data end!")
|
|
|
- redis_helper.set_data_to_redis(
|
|
|
- key_name=f"{config_.REGION_H_DATA_STATUS}:{datetime.datetime.strftime(now_date, '%Y%m%d%H')}",
|
|
|
- value='1', expire_time=2 * 3600
|
|
|
- )
|
|
|
- log_.info(f"region_h_data status update to '1' finished!")
|
|
|
- return
|
|
|
+ # if now_h == 0:
|
|
|
+ # 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(f"region_h_data end!")
|
|
|
+ # redis_helper.set_data_to_redis(
|
|
|
+ # key_name=f"{config_.REGION_H_DATA_STATUS}:{datetime.datetime.strftime(now_date, '%Y%m%d%H')}",
|
|
|
+ # value='1', expire_time=2 * 3600
|
|
|
+ # )
|
|
|
+ # log_.info(f"region_h_data status update to '1' finished!")
|
|
|
+ # return
|
|
|
# 查看当前小时更新的数据是否已准备好
|
|
|
h_data_count = h_data_check(project=project, table=table, now_date=now_date)
|
|
|
if h_data_count > 0:
|