Commit 51439953 authored by 张彦钊's avatar 张彦钊

add time count

parent 820d7c38
......@@ -174,6 +174,7 @@ def update_dairy_queue(score_df,predict_score_df,total_video_id):
def update_sql_dairy_queue(queue_name, diary_id,device_id, city_id):
begin = time.time()
if flag:
db = pymysql.connect(host=QUEUE_ONLINE_HOST, port=3306, user='doris', passwd='o5gbA27hXHHm',
db='doris_prod')
......@@ -192,6 +193,8 @@ def update_sql_dairy_queue(queue_name, diary_id,device_id, city_id):
db.commit()
print("2bd")
db.close()
over = time.time()
print("写入日记队列耗时{}秒".format(over-begin))
print("成功写入diary_id")
......@@ -217,6 +220,7 @@ def queue_compare(old_list, new_list):
def get_queue(device_id, city_id,queue_name):
begin = time.time()
if flag:
db = pymysql.connect(host=QUEUE_ONLINE_HOST, port=3306, user='doris',passwd='o5gbA27hXHHm',
db='doris_prod')
......@@ -229,6 +233,8 @@ def get_queue(device_id, city_id,queue_name):
"where device_id = '{}' and city_id = '{}';".format(queue_name,device_id, city_id)
cursor.execute(sql)
result = cursor.fetchall()
over = time.time()
print("获取日记队列耗时{}秒".format(over-begin))
df = pd.DataFrame(list(result))
if df.empty:
print("该用户对应的日记为空")
......
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