flexmeasures.data.services.forecasting

Forecast orchestration, persistence, and job failure handling.

Functions

flexmeasures.data.services.forecasting.handle_forecasting_exception(job, exc_type, exc_value, traceback)

Persist forecasting job failure metadata.

Forecasting failures stay attached to the original job instead of enqueueing a fallback job.

flexmeasures.data.services.forecasting.run_forecast(pipeline: TrainPredictPipeline, as_job: bool = False, queue: str = 'forecasting') → list[dict] | dict

Orchestrate cycles, saving each completed cycle before starting the next.

flexmeasures.data.services.forecasting.run_forecast_cycle(pipeline: TrainPredictPipeline, *args, **kwargs) → float

Compute and persist one cycle before reporting its runtime to the caller.

flexmeasures.data.services.forecasting.run_prediction(pipeline: PredictPipeline, delete_model: bool = False) → BeliefsDataFrame

Preserve the legacy prediction entrypoint’s exports, save, and cleanup.

flexmeasures.data.services.forecasting.save_forecast(bdf: BeliefsDataFrame, save_changed_beliefs_only: bool = True) → int

Resolve source attribution and commit one cycle’s forecast beliefs, returning how many were saved.

By default, a belief that repeats the belief right before it is not saved again, as for any other data. Pass save_changed_beliefs_only=False to record every belief, for instance to evaluate forecasts per horizon.