lixuejing
commited on
Commit
·
21a006c
1
Parent(s):
cef5903
add log
Browse files- app.py +1 -1
- src/tools/datastatics.py +3 -2
app.py
CHANGED
@@ -493,6 +493,6 @@ with demo:
|
|
493 |
scheduler = BackgroundScheduler()
|
494 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
495 |
scheduler.add_job(update_dynamic_files, "cron", minute=30) # launched every hour on the hour
|
496 |
-
scheduler.add_job(get_statics, 'cron', hour=
|
497 |
scheduler.start()
|
498 |
demo.queue(default_concurrency_limit=40).launch()
|
|
|
493 |
scheduler = BackgroundScheduler()
|
494 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
495 |
scheduler.add_job(update_dynamic_files, "cron", minute=30) # launched every hour on the hour
|
496 |
+
scheduler.add_job(get_statics, 'cron', hour=12, minute=15, timezone='Asia/Shanghai') # 添加定时任务,每天0:30执行一次
|
497 |
scheduler.start()
|
498 |
demo.queue(default_concurrency_limit=40).launch()
|
src/tools/datastatics.py
CHANGED
@@ -9,6 +9,7 @@ def get_statics(save_path=EVAL_REQUESTS_PATH):
|
|
9 |
all_evals = []
|
10 |
|
11 |
for entry in entries:
|
|
|
12 |
if ".json" in entry:
|
13 |
file_path = os.path.join(save_path, entry)
|
14 |
with open(file_path) as fp:
|
@@ -25,10 +26,10 @@ def get_statics(save_path=EVAL_REQUESTS_PATH):
|
|
25 |
|
26 |
finished = len(finished_list)
|
27 |
submmit = len(all_evals)
|
28 |
-
print(finished, submmit)
|
29 |
with open("statics_eachday.json","r") as f:
|
30 |
statics = json.load(f)
|
31 |
-
print(type(statics),str(datetime.datetime.now()), type(str(datetime.datetime.now())))
|
32 |
statics.append({"date":str(datetime.datetime.now()),"finished":finished, "submmit":submmit})
|
33 |
with open("statics_eachday.json","w") as f:
|
34 |
f.write(json.dumps(statics))
|
|
|
9 |
all_evals = []
|
10 |
|
11 |
for entry in entries:
|
12 |
+
print("get_statics", entry)
|
13 |
if ".json" in entry:
|
14 |
file_path = os.path.join(save_path, entry)
|
15 |
with open(file_path) as fp:
|
|
|
26 |
|
27 |
finished = len(finished_list)
|
28 |
submmit = len(all_evals)
|
29 |
+
print("get_stativs",finished, submmit)
|
30 |
with open("statics_eachday.json","r") as f:
|
31 |
statics = json.load(f)
|
32 |
+
print("get_statics",type(statics),str(datetime.datetime.now()), type(str(datetime.datetime.now())))
|
33 |
statics.append({"date":str(datetime.datetime.now()),"finished":finished, "submmit":submmit})
|
34 |
with open("statics_eachday.json","w") as f:
|
35 |
f.write(json.dumps(statics))
|