flexmeasures.data.services.materialized_views
Logic for deciding whether (and up to when) the materialized view caching the most recent beliefs can be trusted, based on when it was last refreshed.
The flexmeasures db-ops refresh-materialized-views CLI command records its last successful run in the latest_task_run table, making that timestamp the single source of truth on the view’s freshness (hosts control the cadence solely via how they schedule that command).
Functions
- flexmeasures.data.services.materialized_views.get_mview_cutoff() datetime | None
Return the datetime before which events can be looked up in the materialized view.
Returns None if the view should not be used at all: no successful refresh has been recorded (yet), or the last one is older than MAX_MVIEW_AGE.