|
@@ -341,11 +341,11 @@ def _main():
|
|
|
profit_threshold = 0.3
|
|
|
condition_choose_real = condition_choose & (predict_df['vov0'] <= profit_threshold)
|
|
|
predict_df["condition_choose"] = condition_choose
|
|
|
- # predict_df[["vid", "曝光占比", "vov0", "condition_choose"]].to_csv(
|
|
|
- # f"{config_manager.project_home}/XGB/file/new_" + (datetime.now() - timedelta(days=1)).strftime("%Y%m%d"),
|
|
|
- # sep="\t",
|
|
|
- # index=False
|
|
|
- # )
|
|
|
+ predict_df[["vid", "曝光占比", "vov0", "condition_choose"]].to_csv(
|
|
|
+ f"{config_manager.project_home}/XGB/file/new_" + (datetime.now() - timedelta(days=1)).strftime("%Y%m%d"),
|
|
|
+ sep="\t",
|
|
|
+ index=False
|
|
|
+ )
|
|
|
|
|
|
choose_bad = condition_choose.sum()
|
|
|
choose_bad_real_bad = condition_choose_real.sum()
|
|
@@ -379,23 +379,23 @@ def _main():
|
|
|
filtered_vid = predict_df.loc[condition_choose, 'vid'].unique()
|
|
|
|
|
|
# 写入本地文件
|
|
|
- # np.savetxt(
|
|
|
- # f"{config_manager.project_home}/XGB/file/filtered_vid_{datetime.now().strftime('%Y%m%d')}.csv",
|
|
|
- # filtered_vid,
|
|
|
- # fmt="%d",
|
|
|
- # delimiter=","
|
|
|
- # )
|
|
|
+ np.savetxt(
|
|
|
+ f"{config_manager.project_home}/XGB/file/filtered_vid_{datetime.now().strftime('%Y%m%d')}.csv",
|
|
|
+ filtered_vid,
|
|
|
+ fmt="%d",
|
|
|
+ delimiter=","
|
|
|
+ )
|
|
|
|
|
|
# 写入Redis
|
|
|
redis_key = f"redis:lower_vov_vid:{datetime.now().strftime('%Y%m%d')}"
|
|
|
|
|
|
logger.info(f"当前环境为: {config_manager.get_env()}, 要写入的Redis Key为: {redis_key}")
|
|
|
- # host, port, password = config_manager.get_algorithm_redis_info()
|
|
|
- # alg_redis = RedisHelper.RedisHelper(host=host, port=port, password=password)
|
|
|
- # for vid in filtered_vid.tolist():
|
|
|
- # alg_redis.add_number_to_set(redis_key, vid)
|
|
|
- #
|
|
|
- # alg_redis.set_expire(redis_key, 86400)
|
|
|
+ host, port, password = config_manager.get_algorithm_redis_info()
|
|
|
+ alg_redis = RedisHelper.RedisHelper(host=host, port=port, password=password)
|
|
|
+ for vid in filtered_vid.tolist():
|
|
|
+ alg_redis.add_number_to_set(redis_key, vid)
|
|
|
+
|
|
|
+ alg_redis.set_expire(redis_key, 86400)
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
@@ -439,7 +439,7 @@ if __name__ == '__main__':
|
|
|
card_json['i18n_header']['zh_cn']["title"]['content'] = "XGB模型训练预测失败"
|
|
|
card_json['i18n_elements']['zh_cn'][0]['content'] = msg_text
|
|
|
# 发送通知
|
|
|
- # feishu_inform_util.send_card_msg_to_feishu(
|
|
|
- # webhook=config_manager.get_vov_model_inform_feishu_webhook(),
|
|
|
- # card_json=card_json
|
|
|
- # )
|
|
|
+ feishu_inform_util.send_card_msg_to_feishu(
|
|
|
+ webhook=config_manager.get_vov_model_inform_feishu_webhook(),
|
|
|
+ card_json=card_json
|
|
|
+ )
|