Skip to content

Fix/detached forecasting sensors#2035

Draft
BelhsanHmida wants to merge 39 commits intomainfrom
fix/detached-forecasting-sensors
Draft

Fix/detached forecasting sensors#2035
BelhsanHmida wants to merge 39 commits intomainfrom
fix/detached-forecasting-sensors

Conversation

@BelhsanHmida
Copy link
Copy Markdown
Contributor

Description

Previously, train/predict cycle jobs were enqueuing a bound TrainPredictPipeline method, which caused the pipeline instance and its ORM-backed sensors/data source to be pickled and sent across the web-worker boundary. In the worker, those objects could be detached from the active DB session and fail with DetachedInstanceError, especially for regressors.

The fix changes cycle jobs to pass only serialized config/parameters plus the data_source_id, and reconstructs the pipeline inside the worker. This keeps ORM objects session-local to the worker and avoids carrying session-bound state through RQ.


Sign-off

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on code under GPL or other license that is incompatible with FlexMeasures

BelhsanHmida and others added 30 commits March 9, 2026 10:37
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: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
…dated

Signed-off-by: F.N. Claessen <claessen@seita.nl>
…ters

Signed-off-by: F.N. Claessen <claessen@seita.nl>
…ycle job

Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
… pipeline

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

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

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…n.commit() some time to finish writing a new source to the db

Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
This reverts commit 888b980.

Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Flix6x and others added 6 commits March 17, 2026 17:29
Signed-off-by: F.N. Claessen <claessen@seita.nl>
… we put it back into the session we are committing

Signed-off-by: F.N. Claessen <claessen@seita.nl>
…b.session.commit() some time to finish writing a new source to the db"

This reverts commit 4ebaa97.

Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community bot commented Mar 18, 2026

Documentation build overview

📚 flexmeasures | 🛠️ Build #31870973 | 📁 Comparing 341751a against latest (487a31b)


🔍 Preview build

Show files changed (5 files in total): 📝 5 modified | ➕ 0 added | ➖ 0 deleted
File Status
genindex.html 📝 modified
_autosummary/flexmeasures.data.models.forecasting.pipelines.base.html 📝 modified
_autosummary/flexmeasures.data.models.forecasting.pipelines.predict.html 📝 modified
_autosummary/flexmeasures.data.models.forecasting.pipelines.train_predict.html 📝 modified
api/v3_0.html 📝 modified

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants