Add improvements

This commit is contained in:
Urtzi Alfaro
2026-01-12 14:24:14 +01:00
parent 6037faaf8c
commit 230bbe6a19
61 changed files with 1668 additions and 894 deletions

View File

@@ -583,17 +583,24 @@ class OrchestrationSaga:
"""
Generate forecasts for tenant.
NOTE: AI insights generated in step 0.5 are already posted to the AI Insights Service
and will be automatically consumed by the forecast service via its dynamic rules engine.
The forecast service queries the AI Insights Service for recent insights when generating
forecasts, so there's no need to explicitly pass them here.
Args:
tenant_id: Tenant ID
context: Execution context
context: Execution context (includes ai_insights_posted count from step 0.5)
Returns:
Forecast result
"""
logger.info(f"Generating forecasts for tenant {tenant_id}")
ai_insights_count = context.get('ai_insights_posted', 0)
logger.info(f"Generating forecasts for tenant {tenant_id} (AI insights available: {ai_insights_count})")
try:
# Call forecast service with circuit breaker protection
# The forecast service will automatically query AI Insights Service for recent insights
if self.forecast_breaker:
result = await self.forecast_breaker.call(
self.forecast_client.generate_forecasts, tenant_id