Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update validate_forecast.py #252

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

utsav-pal
Copy link
Contributor

Pull Request

Description

Made validation optional
Introduced STRICT_VALIDATION environment variable to control whether failures stop execution or just log errors.

Changed return type from None to bool
Instead of raising exceptions, the function returns False on failure, allowing other models to continue.

Replaced hard failures with logging
Errors are now logged instead of stopping execution unless strict validation is enabled.

Ensures all models continue logging even if one fails
By returning False, the function allows other models to log their forecasts without interruption.

Fixes #248

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

@peterdudfield
Copy link
Contributor

Could you update tests too

"""

# Make validation optional using an environment variable
strict_validation = os.getenv("STRICT_VALIDATION", "False").lower() == "true"
Copy link
Contributor

Choose a reason for hiding this comment

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

could this be FORECAST_VALIDATION_RAISE_ERROR

@peterdudfield peterdudfield mentioned this pull request Feb 25, 2025
7 tasks
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.

Make validation error raising optional
2 participants