Spaces:
Sleeping
Sleeping
Commit
·
e6306f4
1
Parent(s):
9c4359c
Still index not running spaces
Browse files- app.py +3 -1
- processing.py +0 -1
app.py
CHANGED
|
@@ -4,6 +4,7 @@ from apscheduler.schedulers.background import BackgroundScheduler
|
|
| 4 |
from fastapi import FastAPI
|
| 5 |
from fastapi.responses import HTMLResponse
|
| 6 |
import uvicorn
|
|
|
|
| 7 |
|
| 8 |
app = FastAPI()
|
| 9 |
|
|
@@ -15,7 +16,8 @@ def index():
|
|
| 15 |
</p>""")
|
| 16 |
|
| 17 |
scheduler = BackgroundScheduler()
|
| 18 |
-
scheduler.add_job(func=process_spaces, trigger="interval", seconds=360
|
|
|
|
| 19 |
scheduler.start()
|
| 20 |
|
| 21 |
if __name__ == "__main__":
|
|
|
|
| 4 |
from fastapi import FastAPI
|
| 5 |
from fastapi.responses import HTMLResponse
|
| 6 |
import uvicorn
|
| 7 |
+
import datetime
|
| 8 |
|
| 9 |
app = FastAPI()
|
| 10 |
|
|
|
|
| 16 |
</p>""")
|
| 17 |
|
| 18 |
scheduler = BackgroundScheduler()
|
| 19 |
+
scheduler.add_job(func=process_spaces, trigger="interval", seconds=360,
|
| 20 |
+
next_run_time=datetime.datetime.now())
|
| 21 |
scheduler.start()
|
| 22 |
|
| 23 |
if __name__ == "__main__":
|
processing.py
CHANGED
|
@@ -48,7 +48,6 @@ def get_info(space_name: SpaceInfo) -> SpaceData | None:
|
|
| 48 |
status = space_info.runtime['stage']
|
| 49 |
if status not in ["SLEEPING", "RUNNING", "RUNNING_BUILDING", "BUILDING"]:
|
| 50 |
print(f"Space not running, building, or sleeping {space_info.id}")
|
| 51 |
-
return None
|
| 52 |
elif status == "SLEEPING":
|
| 53 |
requests.get(f"https://huggingface.co/spaces/{space_info.id}")
|
| 54 |
|
|
|
|
| 48 |
status = space_info.runtime['stage']
|
| 49 |
if status not in ["SLEEPING", "RUNNING", "RUNNING_BUILDING", "BUILDING"]:
|
| 50 |
print(f"Space not running, building, or sleeping {space_info.id}")
|
|
|
|
| 51 |
elif status == "SLEEPING":
|
| 52 |
requests.get(f"https://huggingface.co/spaces/{space_info.id}")
|
| 53 |
|