Commit 16501f87 authored by 张彦钊's avatar 张彦钊

add print for test

parent a6d98355
...@@ -12,7 +12,7 @@ def get_active_users(): ...@@ -12,7 +12,7 @@ def get_active_users():
sql = "select device_id from user_active_time " \ sql = "select device_id from user_active_time " \
"where active_time <= '{}' and active_time >= '{}'".format(now_end,now_start) "where active_time <= '{}' and active_time >= '{}'".format(now_end,now_start)
device_id_df = con_sql(sql) device_id_df = con_sql(sql)
if device_id_df == "0": if device_id_df == 1:
print("当下这一分钟没有活跃用户,不需要预测") print("当下这一分钟没有活跃用户,不需要预测")
# 为了debug supervisor,修改了下面的return参数 # 为了debug supervisor,修改了下面的return参数
return 1,[1,2] return 1,[1,2]
......
...@@ -14,11 +14,12 @@ def con_sql(sql): ...@@ -14,11 +14,12 @@ def con_sql(sql):
cursor = db.cursor() cursor = db.cursor()
cursor.execute(sql) cursor.execute(sql)
result = cursor.fetchall() result = cursor.fetchall()
print("成功从数据库获取数据")
df = pd.DataFrame(list(result)).dropna() df = pd.DataFrame(list(result)).dropna()
db.close() db.close()
# 为了debug supervisor,加了下面的代码 # 为了debug supervisor,加了下面的代码
if df.empty: if df.empty:
return "0" return 1
else: else:
return df return df
......
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