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

change main function for test

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