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>
Flix6x
left a comment
There was a problem hiding this comment.
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>
Flix6x
left a comment
There was a problem hiding this comment.
Well done! I only added some comments for a potential function rename and opening up a new issue to advance our use of Marshmallow.
There was a problem hiding this comment.
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.
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-idever been used at all?data_addand tutorial to usemake_scheduleandcreate_scheduling_jobin the new way.flex_contextparams