Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
6e87864
1
Parent(s):
443abf7
enable auto restart space
Browse files
app.py
CHANGED
|
@@ -63,8 +63,7 @@ from src.tools.plots import (
|
|
| 63 |
def restart_space():
|
| 64 |
print("Running Restart")
|
| 65 |
try:
|
| 66 |
-
|
| 67 |
-
pass
|
| 68 |
except:
|
| 69 |
print("Restart failed")
|
| 70 |
|
|
@@ -535,7 +534,7 @@ def update_dynamic_files_wrapper():
|
|
| 535 |
print(f"Error updating dynamic files: {e}")
|
| 536 |
|
| 537 |
scheduler = BackgroundScheduler()
|
| 538 |
-
scheduler.add_job(restart_space, "interval", seconds=10800) # restarted every 3h
|
| 539 |
scheduler.add_job(update_dynamic_files_wrapper, "cron", minute=30) # launched every hour on the hour
|
| 540 |
scheduler.add_job(update_collections, "date", args=(original_df.copy(),), run_date=datetime.now() + timedelta(minutes=5))
|
| 541 |
scheduler.start()
|
|
|
|
| 63 |
def restart_space():
|
| 64 |
print("Running Restart")
|
| 65 |
try:
|
| 66 |
+
API.restart_space(repo_id=REPO_ID, token=H4_TOKEN)
|
|
|
|
| 67 |
except:
|
| 68 |
print("Restart failed")
|
| 69 |
|
|
|
|
| 534 |
print(f"Error updating dynamic files: {e}")
|
| 535 |
|
| 536 |
scheduler = BackgroundScheduler()
|
| 537 |
+
scheduler.add_job(restart_space, "interval", seconds=10800, next_run_time=datetime.now() + timedelta(hours=3)) # restarted every 3h
|
| 538 |
scheduler.add_job(update_dynamic_files_wrapper, "cron", minute=30) # launched every hour on the hour
|
| 539 |
scheduler.add_job(update_collections, "date", args=(original_df.copy(),), run_date=datetime.now() + timedelta(minutes=5))
|
| 540 |
scheduler.start()
|