Commit 1fe5b11d authored by 张彦钊's avatar 张彦钊

change main function for test

parent 7ddb9cdc
......@@ -93,17 +93,17 @@ def router(device_id):
if __name__ == "__main__":
# TODO 如果耗时小于一分钟,下一次取到的device_id和上一次相同
router('358035085192742')
# while True:
# start = time.time()
# empty,device_id_list = get_active_users()
# if empty:
# time.sleep(10)
# else:
# for device_id in device_id_list:
# router(device_id)
#
# end = time.time()
# time_cost = (end - start)
# print("预测耗时{}秒".format(time_cost))
while True:
start = time.time()
empty,device_id_list = get_active_users()
if empty:
time.sleep(10)
else:
for device_id in device_id_list:
router(device_id)
end = time.time()
time_cost = (end - start)
print("预测耗时{}秒".format(time_cost))
......@@ -11,6 +11,7 @@ cd xlearn
./build.sh
(3) 在nvwa中安装相关工具包:
pip install pymysql
pip install redis
pip install numpy
sudo apt-get install python3-dev
pip install pandas
......
......@@ -19,9 +19,8 @@ def con_sql(sql):
def add_data_to_redis(key,val):
r = redis.StrictRedis(host='10.30.50.58', port=6379, db = 12)
r.set(key, val)
# 设置key的过期时间
r.expire(key,36*60)
# 设置key的过期时间,36小时后过期
r.expire(key,36*60*60)
# ffm 格式转换函数、类
class FFMFormatPandas:
......
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