Skip to content

Feat/update client with 429 and job progress - #225

Merged
nhoening merged 7 commits into
mainfrom
feat/update-client-with-429-and-job-progress
Sep 17, 2026
Merged

nhoening merged 7 commits into
mainfrom
feat/update-client-with-429-and-job-progress

Conversation

@nhoening

Copy link
Copy Markdown
Member

The client was not reacting properly to the 429 / Retry-After information.
We added some other improvements:

  • report sparse information on job progress, rate-limits encountered
  • opt asset update call sites into JSON parsing
  • stop aggregation data after a site report fails

… sparse background-job progress notifications

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@coveralls

coveralls commented Sep 14, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 35258960527

Coverage decreased (-0.8%) to 95.991%

Details

  • Coverage decreased (-0.8%) from the base build.
  • Patch coverage: 6 uncovered changes across 2 files (78 of 84 lines covered, 92.86%).
  • 5 coverage regressions across 1 file.

Uncovered Changes

File Changed Covered %
src/flexmeasures_client/response_handling.py 36 31 86.11%
src/flexmeasures_client/client.py 48 47 97.92%

Coverage Regressions

5 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
src/flexmeasures_client/client.py 5 95.97%

Coverage Stats

Coverage Status
Relevant Lines: 923
Covered Lines: 886
Line Coverage: 95.99%
Coverage Strength: 9.6 hits per line

💛 - Coveralls

@nhoening nhoening self-assigned this Sep 14, 2026
nhoening and others added 3 commits September 17, 2026 14:11
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
The notification callbacks were inserted ahead of polling settings that are already part of the v0.9.6 constructor signature. Positional callers would silently configure callbacks instead of their intended polling intervals, so keep the new notification settings keyword-only and cover the released positional layout with a regression test.

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Job status requests intentionally pass HTTP 422 responses through for wait_for_job to interpret. After a 429 retry, calling every such response successful could contradict the failed job result, so report the actual HTTP status for passed-through errors and retain success wording only for 2xx responses.

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>

@BelhsanHmida BelhsanHmida left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I reviewed and tested this PR locally and added two small fixes in separate commits:

  • 38dcc9e preserves the positional constructor API released in v0.9.6 by making the new notification settings keyword-only. It also adds a regression test confirming that positional job_polling_* values still bind to the intended fields.
  • 5d4f892 corrects the rate-limit recovery notice for passed-through error responses. A 429 followed by a 422 job response now reports the actual HTTP status instead of saying that the request succeeded, with a regression test covering that sequence.

Verification completed locally:

  • Full test suite: 277 passed
  • Full HEMS end-to-end run against an isolated current FlexMeasures server: passed
    • Asset setup, 14 initial ingestion jobs, six forecasts, all 12 scheduling simulation steps, per-step site/community aggregation, and final KPI reports completed successfully
    • The persisted workflow marker contains all five completed phases
    • A second resume run detected the completed setup and correctly skipped every phase

The core 429 retry behavior, Retry-After handling, job polling, and HEMS workflow changes otherwise look sound.

@nhoening
nhoening merged commit d251635 into main Sep 17, 2026
17 checks passed
@nhoening
nhoening deleted the feat/update-client-with-429-and-job-progress branch September 17, 2026 18:37
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.

3 participants