Skip to content

Feat/retire fallback scheduler#2252

Open
BelhsanHmida wants to merge 21 commits into
mainfrom
feat/retire-fallback-scheduler
Open

Feat/retire fallback scheduler#2252
BelhsanHmida wants to merge 21 commits into
mainfrom
feat/retire-fallback-scheduler

Conversation

@BelhsanHmida

@BelhsanHmida BelhsanHmida commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description

  • Turn on SoC constraint relaxation by default for storage scheduling requests.
  • Remove the built-in storage fallback scheduler, so infeasible storage problems now surface as scheduling failures instead of silently producing fallback schedules.
  • Keep the generic fallback redirect/job machinery available for custom schedulers.
  • Update tests and documentation to reflect the new default relaxation and infeasibility behavior.
  • Changelog entry added

Look & Feel

N/A

How to test

pytest flexmeasures/data/schemas/tests/test_scheduling.py \
  flexmeasures/api/v3_0/tests/test_sensor_schedules.py \
  flexmeasures/data/tests/test_scheduling_sequential.py \
  flexmeasures/data/models/planning/tests/test_storage.py

Also ran the targeted solver fallback-retirement test.

Related Items

Closes #2201

Sign-off

  • I confirm that my contribution follows the contribution guidelines.
  • I certify that I wrote the contribution or otherwise have the right to submit it under the project license.

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
@BelhsanHmida BelhsanHmida self-assigned this Jun 26, 2026
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
@BelhsanHmida

Copy link
Copy Markdown
Contributor Author

Manual test done through Swagger UI:

  1. Triggered a storage schedule through:

POST /api/v3_0/assets/8/schedules/trigger

with a flex model that creates a failing storage scheduling job.

  1. The trigger request was accepted and returned a schedule job UUID:

775b2af5-88dd-4988-affd-8b11ec025841

  1. Fetched the schedule through:

GET /api/v3_0/sensors/23/schedules/775b2af5-88dd-4988-affd-8b11ec025841?duration=PT24H&unit=kW&sign-convention=consumption-positive

  1. The response was:

400 BAD REQUEST

with:

{
  "message": "No known schedule for this time period. Scheduling job failed with ValueError: Power capacity on asset 8 is not defined in the flex-model. StorageScheduler was used.",
  "result": "Rejected",
  "status": "UNKNOWN_SCHEDULE"
}

@BelhsanHmida BelhsanHmida requested review from Flix6x, Copilot and nhoening and removed request for nhoening June 28, 2026 21:14

Copilot AI 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.

Pull request overview

This PR retires the built-in storage fallback scheduler so infeasible storage scheduling problems surface as explicit scheduling failures, and it enables SoC constraint relaxation by default for storage scheduling requests. It updates schema defaults, OpenAPI/docs, and tests to reflect the new behavior while keeping generic fallback redirect/job machinery for custom schedulers.

Changes:

  • Default relax-soc-constraints to True for API scheduling flex-context, with corresponding OpenAPI metadata updates
  • Remove StorageFallbackScheduler and its utility fallback policy so infeasible storage schedules fail instead of silently producing fallback schedules
  • Update tests and documentation to validate/report the new default relaxation and failure behavior

Reviewed changes

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

Show a summary per file
File Description
flexmeasures/ui/static/openapi-specs.json Updates OpenAPI defaults/descriptions for SoC relaxation and related flex-model fields
flexmeasures/data/tests/test_scheduling_sequential.py Adjusts sequential scheduling tests to assert failure propagation without storage fallback jobs
flexmeasures/data/schemas/tests/test_sensor.py Refactors quantity assertions to be unit/magnitude-based with tolerance
flexmeasures/data/schemas/tests/test_scheduling.py Adds regression tests for default SoC relaxation behavior in schema loading
flexmeasures/data/schemas/scheduling/metadata.py Updates schema metadata text to reflect default SoC relaxation and soft-constraint semantics
flexmeasures/data/schemas/scheduling/init.py Defaults relax_soc_constraints to true (API) and refines breach-price defaulting behavior; keeps DB default false via override
flexmeasures/data/models/planning/utils.py Removes fallback charging-policy helpers previously used by storage fallback scheduler
flexmeasures/data/models/planning/tests/test_storage.py Updates storage relaxation test expectations to match new default SoC breach pricing behavior
flexmeasures/data/models/planning/tests/test_solver.py Ensures infeasible storage problems raise directly and no fallback scheduler is configured
flexmeasures/data/models/planning/storage.py Removes StorageFallbackScheduler and unsets storage scheduler fallback class
flexmeasures/api/v3_0/tests/test_sensors_api_freshdb.py Makes numeric comparisons tolerant to floating-point rounding via pytest.approx
flexmeasures/api/v3_0/tests/test_sensor_schedules.py Updates API scheduling tests to assert no fallback job creation and direct failure reporting (with/without redirect config)
documentation/features/scheduling.rst Documents infeasible storage behavior and clarifies which constraints remain hard vs soft by default
documentation/configuration.rst Clarifies FLEXMEASURES_FALLBACK_REDIRECT as a custom-scheduler fallback mechanism (not built-in storage)
documentation/changelog.rst Adds user-facing changelog entry for default SoC relaxation and fallback scheduler retirement
documentation/api/introduction.rst Updates 303 redirect documentation to focus on custom scheduler fallbacks and new storage behavior

Comment thread flexmeasures/data/schemas/scheduling/__init__.py
Comment thread flexmeasures/data/schemas/scheduling/__init__.py
Comment thread flexmeasures/data/schemas/scheduling/__init__.py
@BelhsanHmida BelhsanHmida requested review from Flix6x and removed request for Flix6x July 5, 2026 19:09
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.

Retire the Fallback Scheduler

2 participants