Spaces:
Runtime error
Runtime error
update
Browse files
app.py
CHANGED
@@ -130,17 +130,22 @@ def download_leaderboard_dataset():
|
|
130 |
|
131 |
path_ = download_leaderboard_dataset()
|
132 |
|
|
|
|
|
133 |
def run_update_dataset():
|
134 |
global path_
|
135 |
for i in range(0, len(rl_envs)):
|
136 |
rl_env = rl_envs[i]
|
137 |
update_leaderboard_dataset_parallel(rl_env["rl_env"], path_)
|
138 |
-
|
|
|
|
|
|
|
139 |
api.upload_folder(
|
140 |
folder_path=path_,
|
141 |
repo_id="huph22/drlc-leaderboard-data",
|
142 |
repo_type="dataset",
|
143 |
-
commit_message=
|
144 |
|
145 |
|
146 |
def get_data(rl_env, path) -> pd.DataFrame:
|
@@ -255,13 +260,18 @@ with block:
|
|
255 |
)
|
256 |
"""
|
257 |
|
258 |
-
|
259 |
scheduler = BackgroundScheduler()
|
260 |
-
# Refresh every hour
|
261 |
-
#scheduler.add_job(func=run_update_dataset, trigger="interval", seconds=3600)
|
262 |
-
#scheduler.add_job(download_leaderboard_dataset, 'interval', seconds=3600)
|
263 |
scheduler.add_job(run_update_dataset, 'interval', seconds=3600)
|
264 |
-
#scheduler.add_job(restart, 'interval', seconds=10800)
|
265 |
scheduler.start()
|
266 |
|
267 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
path_ = download_leaderboard_dataset()
|
132 |
|
133 |
+
from datetime import datetime
|
134 |
+
|
135 |
def run_update_dataset():
|
136 |
global path_
|
137 |
for i in range(0, len(rl_envs)):
|
138 |
rl_env = rl_envs[i]
|
139 |
update_leaderboard_dataset_parallel(rl_env["rl_env"], path_)
|
140 |
+
# 获取当前时间
|
141 |
+
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
142 |
+
# 构建带时间戳的 commit_message
|
143 |
+
commit_message = f"Update dataset at {current_time}"
|
144 |
api.upload_folder(
|
145 |
folder_path=path_,
|
146 |
repo_id="huph22/drlc-leaderboard-data",
|
147 |
repo_type="dataset",
|
148 |
+
commit_message=commit_message)
|
149 |
|
150 |
|
151 |
def get_data(rl_env, path) -> pd.DataFrame:
|
|
|
260 |
)
|
261 |
"""
|
262 |
|
263 |
+
import threading
|
264 |
scheduler = BackgroundScheduler()
|
|
|
|
|
|
|
265 |
scheduler.add_job(run_update_dataset, 'interval', seconds=3600)
|
|
|
266 |
scheduler.start()
|
267 |
|
268 |
+
def start_block_launch():
|
269 |
+
block.launch()
|
270 |
+
launch_thread = threading.Thread(target=start_block_launch)
|
271 |
+
launch_thread.start()
|
272 |
+
|
273 |
+
try:
|
274 |
+
while True:
|
275 |
+
time.sleep(60) # 主线程保持活跃
|
276 |
+
except (KeyboardInterrupt, SystemExit):
|
277 |
+
scheduler.shutdown()
|