Start fixing forecast service 18

This commit is contained in:
Urtzi Alfaro
2025-07-30 08:41:47 +02:00
parent c10a745695
commit 024290e4c0
2 changed files with 25 additions and 14 deletions

View File

@@ -122,15 +122,17 @@ class ForecastingService:
# Metadata
created_at=forecast.created_at,
processing_time_ms=forecast.processing_time_ms,
processing_time_ms=int((datetime.now() - start_time).total_seconds() * 1000),
features_used=forecast.features_used
)
except Exception as e:
processing_time = int((datetime.now() - start_time).total_seconds() * 1000)
logger.error("Error generating forecast",
error=str(e),
product=request.product_name,
tenant_id=tenant_id)
tenant_id=tenant_id,
processing_time=processing_time)
raise
async def _get_latest_model_with_fallback(
@@ -422,6 +424,8 @@ class ForecastingService:
) -> Forecast:
"""Save forecast to database"""
start_time = datetime.now()
forecast = Forecast(
tenant_id=tenant_id,
product_name=request.product_name,