Skip to content

Conversation

@agmangas
Copy link
Member

Wrap all pybuildingenergy simulation calls that use weather_source="pvgis" with a retry decorator (multiple attempts and exponential backoff) to handle transient network failures from the EU PVGIS API.

Wrap all pybuildingenergy simulation calls that use weather_source="pvgis"
with a retry decorator (3 attempts, exponential backoff) to handle transient
network failures from the EU PVGIS API.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a reusable retry decorator with exponential backoff and applies it to PVGIS-backed pybuildingenergy simulation calls to better handle transient PVGIS network failures.

Changes:

  • Introduce retry_on_transient_error decorator utility (configurable retries + exponential backoff).
  • Wrap PVGIS simulation calls in main.py and forecasting_service_functions.py with the retry decorator.
  • Add logging around transient failures and retry attempts.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
src/relife_forecasting/utils/retry.py New retry/backoff decorator intended to make external API calls (PVGIS) more resilient.
src/relife_forecasting/routes/forecasting_service_functions.py Wrap PVGIS simulation worker call with the retry decorator.
src/relife_forecasting/main.py Wrap PVGIS simulation calls in API endpoints with the retry decorator.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ReLIFE-Project-EU ReLIFE-Project-EU deleted a comment from Copilot AI Feb 10, 2026
agmangas and others added 2 commits February 10, 2026 18:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Add parameter validation (max_retries >= 1, initial_delay >= 0, backoff_factor > 0)
- Make decorator async-aware to avoid blocking event loop with time.sleep
- Add missing retry wrapper for PVGIS call in /ecm_application/run_sequential_save
- Add comprehensive test coverage for retry utilities

Addresses:
- Review comment about invalid parameters causing TypeError
- Review comment about blocking event loop in async contexts
- Review comment about missing PVGIS retry wrapper
@agmangas agmangas merged commit 24c68a9 into main Feb 11, 2026
2 checks passed
@agmangas agmangas deleted the fix/pvgis-api-retry-resilience branch February 11, 2026 09:24
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.

1 participant