-
Notifications
You must be signed in to change notification settings - Fork 36
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
Refactor scheduler interface - API and inner logic #537
Conversation
…heduler implementations (moving some endpoint logic here); 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>
Pull Request Test Coverage Report for Build 3799875511
💛 - Coveralls |
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
…f params with underscore in docstring Signed-off-by: Nicolas Höning <nicolas@seita.nl>
…e endpoint 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>
… in dummy custom scheduler Signed-off-by: Nicolas Höning <nicolas@seita.nl>
…es in v3.0 as well, using a way that lets all schedulers save (parts of) it if they want. Signed-off-by: Nicolas Höning <nicolas@seita.nl>
…re we apply the schema (which expects non-nan values here) Signed-off-by: Nicolas Höning <nicolas@seita.nl>
…mall refactoring to save lines Signed-off-by: Nicolas Höning <nicolas@seita.nl>
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.
Impressive work so far. Here are some documentation suggestions already.
…e might choose that the CLI will be specific to our in-built flex models) Signed-off-by: Nicolas Höning <nicolas@seita.nl>
… to small fix in API endpoint and scheduling tests Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
For me, only one item remains in this PR: I chose for underscores in the flex model and flex context parameter names to the API, but I now believe I could give users the "-" notation which we have used before as well. |
…the API to use hyphens, which is conventionally preferred. 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>
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>
…s/flexmeasures into refactor-scheduler-interface
I noticed some unaddressed review comments, some of which may be worthwhile to discuss, like #537 (comment). |
Oh yes, that one did escape, thanks for reminding. |
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>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
…context (#564) * Add deprecation and sunset response headers when deprecated fields are used Signed-off-by: F.N. Claessen <felix@seita.nl> * Refactor: duplicate code becomes util function Signed-off-by: F.N. Claessen <felix@seita.nl> * Correct deprecation and sunset links Signed-off-by: F.N. Claessen <felix@seita.nl> * rename to represent plural-default of param, update link to 3.0.5 API changelog Signed-off-by: Nicolas Höning <nicolas@seita.nl> Signed-off-by: F.N. Claessen <felix@seita.nl> Signed-off-by: Nicolas Höning <nicolas@seita.nl> Co-authored-by: Nicolas Höning <nicolas@seita.nl>
… from soc targets Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
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.
Well done! I only added some comments for a potential function rename and opening up a new issue to advance our use of Marshmallow.
"soc_in_mwh", self.flex_model["soc_at_start"] | ||
) | ||
|
||
def inspect_flex_config(self): |
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.
Maybe just a note for later: we use a Marshmallow schema in this function, which by now does not only do validation, but also deserialization (which is what changes the flex config fields with dash notation to the flex config variables with underscore notation). This is already disclosed in the docstring, but I believe the function name could bring that to light better, because it's more than an inspection at this point. Maybe deserialize_flex_config
. The function also fills in defaults (if needed), but this can be done in the schema, too, using load_default
.
Ideas: | ||
- Apply a schema to check validity (see in-built flex model schemas) | ||
- Check for inconsistencies between settings (can also happen in Marshmallow) | ||
- fill in missing values from the scheduler's knowledge (e.g. sensor attributes) |
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.
FYI: I found out how to access the sensor object (deserialized from location="path"
) in the schema used for deserializing fields from location="json"
(using https://webargs.readthedocs.io/en/latest/advanced.html#meta-locations). Knowing this, filling in missing values can also happen using Marshmallow, e.g. using @validates(field_name)
or @validates_schema
. So all three of these ideas can happen in Marshmallow, which may be worth a note and/or a follow-up ticket.
Btw, I started using these meta-locations in #563, so I know how to make that work now.
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
… planning module without needing plugin developers to upgrade their code) Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
TODO:
soc-sensor-id
ever been used at all?data_add
and tutorial to usemake_schedule
andcreate_scheduling_job
in the new way.flex_context
params