Skip to content

Suppress LoadML component errors while forecasts are calculating#4275

Open
nickgee31 wants to merge 3 commits into
springfall2008:mainfrom
nickgee31:load-ml-warning
Open

Suppress LoadML component errors while forecasts are calculating#4275
nickgee31 wants to merge 3 commits into
springfall2008:mainfrom
nickgee31:load-ml-warning

Conversation

@nickgee31

Copy link
Copy Markdown
Contributor

Prevents Predbat’s main status from reporting ML Load Forecaster as an error while LoadML is actively calculating.

The underlying run status is preserved, so Predbat continues to show the appropriate state such as Demand, Export, or Idle. LoadML failures outside calculation—and failures from other components—still report errors normally.

Adds regression tests covering both calculating and genuine LoadML failure states.

nickgee31 and others added 2 commits July 20, 2026 10:46
The ML Load Forecaster component naturally enters an unhealthy state during its calculations. This fix prevents temporary calculation states from incorrectly marking the overall run as failed. LoadML failures outside of calculation periods are still reported as expected.
# Conflicts:
#	apps/predbat/tests/test_component_health_status.py
Comment thread apps/predbat/predbat.py Outdated
error_count += 1
failed_components.append(COMPONENT_LIST.get(component_name, {}).get("name", component_name))
component = self.components.get_component(component_name)
is_load_ml_calculating = component_name == "load_ml" and component and component.is_calculating()

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we do this in a less hard-wired way, e.g. add a is_calculating to the base class that returns False and then override it for load_ml to return True when calculating and then remove the =="load_ml" here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good idea, have added that now

Introduce ComponentBase.is_calculating() (defaults to False) so components can indicate long-running calculations. Update predbat health check to call component.is_calculating() instead of special-casing "load_ml". Add a unit test (test_component_base_not_calculating) and include it in the test list to assert the default behaviour. Files changed: component_base.py, predbat.py, tests/test_component_base.py.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants