Fix training start 2

This commit is contained in:
Urtzi Alfaro
2025-07-25 19:03:20 +02:00
parent ebb39aa8c9
commit 4f459f31f6
2 changed files with 5 additions and 5 deletions

View File

@@ -29,7 +29,7 @@ from app.services.messaging import (
)
from sqlalchemy.ext.asyncio import AsyncSession
from app.core.database import get_db
from app.core.database import get_db_session
# Import unified authentication from shared library
from shared.auth.decorators import (
@@ -48,7 +48,7 @@ async def start_training_job(
tenant_id: str = Depends(get_current_tenant_id_dep),
current_user: Dict[str, Any] = Depends(get_current_user_dep),
training_service: TrainingService = Depends(),
db: AsyncSession = Depends(get_db) # Ensure db is available
db: AsyncSession = Depends(get_db_session) # Ensure db is available
):
"""Start a new training job for all products"""
try:

View File

@@ -16,7 +16,7 @@ from fastapi.responses import JSONResponse
import uvicorn
from app.core.config import settings
from app.core.database import database_manager, get_db_health
from app.core.database import initialize_training_database, cleanup_training_database
from app.api import training, models
from app.services.messaging import setup_messaging, cleanup_messaging
from shared.monitoring.logging import setup_logging
@@ -41,7 +41,7 @@ async def lifespan(app: FastAPI):
try:
# Initialize database
logger.info("Initializing database connection")
await database_manager.create_tables()
initialize_training_database()
logger.info("Database initialized successfully")
# Initialize messaging
@@ -81,7 +81,7 @@ async def lifespan(app: FastAPI):
logger.info("Messaging cleanup completed")
# Close database connections
await database_manager.close_connections()
cleanup_training_database()
logger.info("Database connections closed")
except Exception as e: