Suppress LoadML component errors while forecasts are calculating#4275
Open
nickgee31 wants to merge 3 commits into
Open
Suppress LoadML component errors while forecasts are calculating#4275nickgee31 wants to merge 3 commits into
nickgee31 wants to merge 3 commits into
Conversation
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
| 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() |
Owner
There was a problem hiding this comment.
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?
Contributor
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.