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
FLEXMEASURES_MAX_PLANNING_HORIZON can be int #583
FLEXMEASURES_MAX_PLANNING_HORIZON can be int #583
Conversation
Signed-off-by: F.N. Claessen <felix@seita.nl>
Pull Request Test Coverage Report for Build 3943213675
💛 - Coveralls |
…divisible by 1-10, which yields pleasant-looking durations for common sensor resolutions Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
…-size-of-planning-window
|
||
Default: ``timedelta(days=7, hours=1)`` | ||
Default: ``2520`` (e.g. 7 days for a 4-minute resolution sensor, 105 days for a 1-hour resolution sensor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just thinking about this, and it seems to me that this is a rather large default horizon. This will eat a lot of CPU budget.
To me, ~10% of this is reasonable (a bit over 2 weeks for a 1-hour sensor, a day for a 5-minute sensor)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also a thought for the future: this might have to change per account (at first via an attribute, I guess), as this is possibly relevant for billing flex scheduling services.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just thinking about this, and it seems to me that this is a rather large default horizon. This will eat a lot of CPU budget.
This is not the default horizon (which is currently set to 2 days), but the default max horizon. I agree that this is a rather large value, but it is what the FlexMeasures scheduler can currently handle without the scheduling jobs timing out after 180 seconds.
I also thought of coupling this PR with the introduction of a config setting to allow FlexMeasures hosts to overwrite python-rq's default job timeout of 180 seconds for the scheduling queue, but I decided to save that for a separate PR. That would be a simple change in app.py
, something like:
Queue(name="scheduling", default_timeout=app.config["FLEXMEASURES_PLANNING_TIMEOUT"])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, sorry for the oversight. Actually, I would advise we give FLEXMEASURES_PLANNING_HORIZON
the same treatment (that it can be an int).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about that, too, but I didn't find the use case particularly convincing. Is it a worthwhile extra feature, or just resolves an itchy asymmetry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latter. But these things matter for user experience. I would expect these two to work the same.
And I believe we are not breaking existing settings here. Now is the cheapest time to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now is the cheapest time to do this.
I started implementing your request, but it turns out this is probably not true. The FLEXMEASURES_PLANNING_HORIZON
is used in API versions 1.2 and 1.3, which allow retrieving schedules for multiple sensors in a single API call. That code assumes that the planning horizon is the same for all of these sensors, which with an integer FLEXMEASURES_PLANNING_HORIZON
would no longer be the case. So this would currently require refactoring of already deprecated code.
I'd say it is cheaper to implement your request after these API versions are sunset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds reasonable, can we make a ticket for version 0.14?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: F.N. Claessen <felix@seita.nl>
…-size-of-planning-window
Signed-off-by: F.N. Claessen <felix@seita.nl>
Closes #570.