You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The scheduler will try to read data for attributes with get_continuous_series_sensor_or_quantity(), also using fallback attributes, which in my case (the site-consumption-capacity field is set in the flex context, as sensor) turns out to be something like {"sensor": 26}, and fail.
This is what I see when testing scheduling (from CLI): HANDLING RQ SCHEDULING WORKER EXCEPTION: <class 'TypeError'>:Invalid magnitude for Quantity: {'sensor': 26}
We could support that these utils understand the sensor structure, or we rethink the idea that flex context fields are available as asset attributes. I don't know why it was needed.
We could give asset.get_attribute() a parameter (values_only) to avoid this kind of lookup.
But in general, I believe users probably believe they receive some value with an attribute lookup, not a sensor spec.
Opinions?
The text was updated successfully, but these errors were encountered:
nhoening
changed the title
Flex context sensors are not handled correctly in scheduler yet
Flex context sensors are not handled correctly in scheduler yet when used as fallback attributes
Mar 17, 2025
To replicate: set "Site Consumption Capacity" field of an asset to a sensor, and attempt to create a schedule (e.g. using the toy tutorial)
In the line below,
asset.get_attribute()
was extended to return also flex context fields:https://github.com/FlexMeasures/flexmeasures/pull/1293/files#diff-9a3e4dca97ba0f73dab16ea74e2711fdbf6cbb3c6a0fe71784ec52f26df2f7a0R331
The scheduler will try to read data for attributes with
get_continuous_series_sensor_or_quantity()
, also using fallback attributes, which in my case (thesite-consumption-capacity
field is set in the flex context, as sensor) turns out to be something like{"sensor": 26}
, and fail.This is what I see when testing scheduling (from CLI):
HANDLING RQ SCHEDULING WORKER EXCEPTION: <class 'TypeError'>:Invalid magnitude for Quantity: {'sensor': 26}
We could support that these utils understand the sensor structure, or we rethink the idea that flex context fields are available as asset attributes. I don't know why it was needed.
We could give
asset.get_attribute()
a parameter (values_only
) to avoid this kind of lookup.But in general, I believe users probably believe they receive some value with an attribute lookup, not a sensor spec.
Opinions?
The text was updated successfully, but these errors were encountered: