Commit 4300c804 authored by 张彦钊's avatar 张彦钊

delete redis

parent 32b39b12
......@@ -3,7 +3,6 @@ from datetime import datetime
from datetime import timedelta
import pymysql
import numpy as np
import redis
import pandas as pd
from sklearn import metrics
from sklearn.metrics import auc
......@@ -46,15 +45,6 @@ def con_sql(sql):
return df
# 把数据写到redis里
# TODO 生产环境的redis地址没有提供,下面的地址是测试环境的,需要改成生产环境地址
def add_data_to_redis(key, val):
r = redis.StrictRedis(host='10.30.50.58', port=6379, db=12)
r.set(key, val)
# 设置key的过期时间,36小时后过期
r.expire(key, 36 * 60 * 60)
# 多线程ffm转化类:
class multiFFMFormatPandas:
def __init__(self):
......
......@@ -52,9 +52,6 @@ def predict(user_profile):
print("该用户预测结束")
predict_save_to_local(user_profile, instance)
#TODO 没有提供生产环境的redis地址,所以这个函数先不运行
# predict_save_to_redis(user_profile, instance)
# 将预测结果与device_id 进行拼接,并按照概率降序排序
def wrapper_result(user_profile, instance):
proba = pd.read_csv(DIRECTORY_PATH +
......@@ -72,12 +69,6 @@ def predict_save_to_local(user_profile, instance):
proba.to_csv(DIRECTORY_PATH + "result/feed_{}".format(user_profile['device_id']), index=False)
print("成功将预测候选集保存到本地")
# 预测候选集保存到redis
def predict_save_to_redis(user_profile, instance):
device_id = user_profile['device_id']
cid_list = wrapper_result(user_profile, instance)["cid"].values.tolist()
add_data_to_redis(device_id,cid_list)
print("成功将预测候选集保存到redis")
def router(device_id):
user_profile, not_exist = fetch_user_profile(device_id)
......
......@@ -3,7 +3,6 @@ from datetime import datetime
from datetime import timedelta
import pymysql
import numpy as np
import redis
import pandas as pd
from sklearn import metrics
from sklearn.metrics import auc
......@@ -73,15 +72,6 @@ def restart_process():
print("成功重启diaryUpdateOnlineOffline.py")
# 把数据写到redis里
# TODO 生产环境的redis地址没有提供,下面的地址是测试环境的,需要改成生产环境地址
def add_data_to_redis(key, val):
r = redis.StrictRedis(host='10.30.50.58', port=6379, db=12)
r.set(key, val)
# 设置key的过期时间,36小时后过期
r.expire(key, 36 * 60 * 60)
# 多线程ffm转化类:
class multiFFMFormatPandas:
def __init__(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment