mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-11-25 23:16:18 +01:00
fix(prediction): update all providers before reporting a failing one
The prediction container stopped at the first enabled provider that failed to update, so the providers after it in the sequence were not updated in that run. A failing weather provider, at the start of the sequence, thus also kept the electricity price, feed-in tariff, load and PV forecasts from being updated. The container now updates all providers and then raises one RuntimeError with the failures of all enabled providers; with one failing provider the message is unchanged. Refs #1571 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assisted-by: Claude Code (claude-opus-5-5)
This commit is contained in:
committed by
Bobby Noelte
co-authored by
Claude Opus 5.5
parent
867bc38fc0
commit
c8f793c203
@@ -2483,13 +2483,18 @@ class DataContainer(SingletonMixin, DataABC, Generic[DataProviderT]):
|
||||
concurrent writes or other bulk operations can interleave with the
|
||||
provider updates.
|
||||
|
||||
A failing provider does not stop the update: the remaining providers are
|
||||
updated first, then the failures of the enabled providers are raised together.
|
||||
|
||||
Args:
|
||||
force_enable: If True, forces the update even if a provider is disabled.
|
||||
force_update: If True, forces providers to update even if data is cached.
|
||||
|
||||
Raises:
|
||||
RuntimeError: If an enabled provider fails during update.
|
||||
RuntimeError: If one or more enabled providers fail during update, after
|
||||
all providers have been updated.
|
||||
"""
|
||||
errors: list[str] = []
|
||||
async with self._container_lock:
|
||||
for provider in self.providers:
|
||||
try:
|
||||
@@ -2504,13 +2509,16 @@ class DataContainer(SingletonMixin, DataABC, Generic[DataProviderT]):
|
||||
f":\n{e}\n{trace}"
|
||||
)
|
||||
if provider.enabled():
|
||||
# The active provider failed — this is a real error worth propagating.
|
||||
# The active provider failed — this is a real error worth propagating,
|
||||
# but only after the remaining providers were updated.
|
||||
logger.error(error)
|
||||
raise RuntimeError(error)
|
||||
errors.append(error)
|
||||
else:
|
||||
# A non-active provider failed (e.g. missing config while force_enable=True).
|
||||
# Log as warning and continue so the remaining providers still run.
|
||||
logger.warning(error)
|
||||
if errors:
|
||||
raise RuntimeError("\n".join(errors))
|
||||
|
||||
async def key_to_raw_series(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user