Spaces:
Running
Running
ensure necessary jobs are launched
Browse files- src/main.py +8 -0
src/main.py
CHANGED
|
@@ -38,6 +38,7 @@ from src.entity.player import (
|
|
| 38 |
PlayerApiDetail,
|
| 39 |
)
|
| 40 |
from src.jobs.match import schedule_matches_ingestion
|
|
|
|
| 41 |
from src.repository.common import get_session
|
| 42 |
from src.service.match import (
|
| 43 |
insert_new_match,
|
|
@@ -58,6 +59,13 @@ def provide_connection() -> Generator[Session, None, None]:
|
|
| 58 |
|
| 59 |
# ------------------------------------------------------------------------------
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
TENNIS_ML_API = os.getenv("TENNIS_ML_API")
|
| 62 |
|
| 63 |
@asynccontextmanager
|
|
|
|
| 38 |
PlayerApiDetail,
|
| 39 |
)
|
| 40 |
from src.jobs.match import schedule_matches_ingestion
|
| 41 |
+
from src.jobs.views import schedule_refresh
|
| 42 |
from src.repository.common import get_session
|
| 43 |
from src.service.match import (
|
| 44 |
insert_new_match,
|
|
|
|
| 59 |
|
| 60 |
# ------------------------------------------------------------------------------
|
| 61 |
|
| 62 |
+
# Ensure all the necessary jobs are scheduled
|
| 63 |
+
if os.getenv("REDIS_URL"):
|
| 64 |
+
schedule_refresh()
|
| 65 |
+
schedule_matches_ingestion(year=None)
|
| 66 |
+
|
| 67 |
+
# ------------------------------------------------------------------------------
|
| 68 |
+
|
| 69 |
TENNIS_ML_API = os.getenv("TENNIS_ML_API")
|
| 70 |
|
| 71 |
@asynccontextmanager
|