FIX: Start training queue workers on startup - jobs will now actually process!
Browse files- app/main.py +13 -0
app/main.py
CHANGED
|
@@ -102,11 +102,24 @@ async def startup_event():
|
|
| 102 |
from app.database import init_db
|
| 103 |
await init_db()
|
| 104 |
logger.info("Database tables initialized")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
logger.info("Routers registered: auth, models, datasets, training, system, jobs")
|
| 106 |
|
| 107 |
@app.on_event("shutdown")
|
| 108 |
async def shutdown_event():
|
| 109 |
logger.info("Universal Model Trainer shutting down...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
# Catch-all for 404 errors
|
| 112 |
@app.exception_handler(404)
|
|
|
|
| 102 |
from app.database import init_db
|
| 103 |
await init_db()
|
| 104 |
logger.info("Database tables initialized")
|
| 105 |
+
|
| 106 |
+
# START THE TRAINING QUEUE - THIS WAS MISSING!
|
| 107 |
+
from app.routers.training import get_queue
|
| 108 |
+
queue = get_queue()
|
| 109 |
+
await queue.start()
|
| 110 |
+
logger.info("Training queue started - workers are now processing jobs")
|
| 111 |
+
|
| 112 |
logger.info("Routers registered: auth, models, datasets, training, system, jobs")
|
| 113 |
|
| 114 |
@app.on_event("shutdown")
|
| 115 |
async def shutdown_event():
|
| 116 |
logger.info("Universal Model Trainer shutting down...")
|
| 117 |
+
|
| 118 |
+
# Stop the training queue gracefully
|
| 119 |
+
from app.routers.training import get_queue
|
| 120 |
+
queue = get_queue()
|
| 121 |
+
await queue.stop()
|
| 122 |
+
logger.info("Training queue stopped")
|
| 123 |
|
| 124 |
# Catch-all for 404 errors
|
| 125 |
@app.exception_handler(404)
|