Commit 650e2992 authored by 张彦钊's avatar 张彦钊

update dairyQueueUpdate file

parent e5abdf9b
......@@ -249,11 +249,12 @@ def user_update(device_id,city_id,data_set_cid):
def run():
data_set_cid = pd.read_csv(DIRECTORY_PATH + "data_set_cid.csv")["cid"].values.tolist()
device_city_list = get_active_users()
# TODO 测试通过后加上计时
start = time.time()
for device_city in device_city_list:
start = time.time()
user_update(device_city[0], device_city[1],data_set_cid)
end = time.time()
end = time.time()
print("更新该用户队列耗时{}秒".format((end-start)))
print("end")
......
......@@ -31,23 +31,18 @@ def get_active_users():
print("该列表是新用户,不需要预测")
else:
# TODO 正式上线后注释下面的只预测尾号是6的代码
# 只预测尾号是6的ID,这块是测试要求的,这块也可以在数据库取数据时过滤一下
device_temp_list = df["device_id"].values.tolist()
predict_list = list(filter(lambda x: str(x)[-1] == "6", device_temp_list))
df = df.loc[df["device_id"].isin(predict_list)]
# 只预测尾号是6的ID,这块是测试要求的
# device_temp_list = df["device_id"].values.tolist()
# predict_list = list(filter(lambda x: str(x)[-1] == "6", device_temp_list))
# df = df.loc[df["device_id"].isin(predict_list)]
# TODO 上线后把下面的temp删掉
# 把刘潇和雅喆的id加进去
temp = pd.DataFrame({"device_id":["AB20292B-5D15-4C44-9429-1C2FF5ED26F6","358035085192742"],
"city_id":["beijing","beijing"]})
df = df.append(temp)
if df.empty:
print("没有尾号是6的用户,不需要预测")
else:
device_list = df["device_id"].values.tolist()
city_list = df["city_id"].values.tolist()
device_city_list = list(zip(device_list, city_list))
return device_city_list
# 把刘潇的id加进去
df = pd.DataFrame({"device_id":["358035085192742"],"city_id":["beijing"]})
device_list = df["device_id"].values.tolist()
city_list = df["city_id"].values.tolist()
device_city_list = list(zip(device_list, city_list))
print("当下这一分钟预测用户数量:{}".format(len(device_city_list)))
return device_city_list
def fetch_user_profile(device_id):
......
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