Commit
•
b2895a3
1
Parent(s):
ffb4837
add a scheduler for restart in case of failure of automatic updates
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ from threading import Thread
|
|
8 |
import datasets
|
9 |
from huggingface_hub import snapshot_download, WebhooksServer, WebhookPayload, RepoCard
|
10 |
from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
|
|
|
11 |
|
12 |
# Start ephemeral Spaces on PRs (see config in README.md)
|
13 |
from gradio_space_ci.webhook import IS_EPHEMERAL_SPACE, SPACE_ID, configure_space_ci
|
@@ -465,3 +466,7 @@ def update_queue(payload: WebhookPayload) -> None:
|
|
465 |
LAST_UPDATE_QUEUE = datetime.datetime.now()
|
466 |
|
467 |
webhooks_server.launch()
|
|
|
|
|
|
|
|
|
|
8 |
import datasets
|
9 |
from huggingface_hub import snapshot_download, WebhooksServer, WebhookPayload, RepoCard
|
10 |
from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
|
11 |
+
from apscheduler.schedulers.background import BackgroundScheduler
|
12 |
|
13 |
# Start ephemeral Spaces on PRs (see config in README.md)
|
14 |
from gradio_space_ci.webhook import IS_EPHEMERAL_SPACE, SPACE_ID, configure_space_ci
|
|
|
466 |
LAST_UPDATE_QUEUE = datetime.datetime.now()
|
467 |
|
468 |
webhooks_server.launch()
|
469 |
+
|
470 |
+
scheduler = BackgroundScheduler()
|
471 |
+
scheduler.add_job(restart_space, "interval", hours=3) # restarted every 3h as backup in case automatic updates are not working
|
472 |
+
scheduler.start()
|