If sensors are deleted (via SQL), the scheduler should report this in a clean way.
The PR for this issue should improve what happens if a sensor that is referenced in the flex-model or flex-context does not exist.
I tested two situations, with differing outcomes:
- sensor in flex-context is missing
With my --flex-context parameter in the CLI being {"consumption-price": {"sensor": 222222}}, I got:
marshmallow.exceptions.ValidationError: {'consumption-price': ['No sensor found with ID 222222.']}
That is helpful.
- sensor in flex-model is missing
With my --flex-model parameter in the CLI being [{"sensor": 44207999, "soc-at-start": "4 kWh", "roundtrip-efficiency": 0.9, "soc-min": "2 kWh"}], I got:
File "/home/nicolas/workspace/seita/flexmeasures/flexmeasures/data/services/scheduling.py", line 252, in create_scheduling_job
scheduler.collect_flex_config()
File "/home/nicolas/workspace/seita/flexmeasures/flexmeasures/data/models/planning/__init__.py", line 211, in collect_flex_config
asset_id = sensor.asset_id
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'asset_id'
That is not helpful enough.
Bonus: check if the forecaster fails clearly in this situation.
If sensors are deleted (via SQL), the scheduler should report this in a clean way.
The PR for this issue should improve what happens if a sensor that is referenced in the flex-model or flex-context does not exist.
I tested two situations, with differing outcomes:
With my
--flex-contextparameter in the CLI being{"consumption-price": {"sensor": 222222}}, I got:That is helpful.
With my
--flex-modelparameter in the CLI being[{"sensor": 44207999, "soc-at-start": "4 kWh", "roundtrip-efficiency": 0.9, "soc-min": "2 kWh"}], I got:That is not helpful enough.
Bonus: check if the forecaster fails clearly in this situation.