View code on Github

v0.6.0: Multi-tenancy & error monitoring 

Eggs, by Landon Martin
Eggs, by Landon Martin

Version v0.6.0 of FlexMeasures is out (see changelog). The two most notable new features are that users and assets now belong to accounts (allowing for multi-tenancy setups), and that it's now possible to monitor for things going wrong (and be able to react in time).

Multi-tenancy

We envision that there'll be one FlexMeasures server run per ESCO. However, they have multiple customers. Of course, we want to treat them differently in terms of what they see and also silo their data from other customers.

We updated the data model ― we added an account table, to which users and assets are connected. Accounts can also have roles. We made use of these account roles right away in enabling the UI to show different things to users from different (kind of) accounts, e.g. a different landing page or menu links.

This work was done in Pull Request 159 and Pull Request 163.

Error monitoring

When you run a FlexMeasures server, you want to stay on top of things going wrong. We added two ways of doing that:

  1. You can connect to Sentry, so that all errors will be sent to your Sentry account. Add the token you got from Sentry in the SENTRY_DNS config setting and you're up and running! See Pull Request 143.
  2. Another source of crucial errors are things that did not even happen! For instance, a task to import prices from a day-ahead market, which you depend on later for scheduling. We added a new CLI task called flexmeasures monitor tasks, so you can be alerted when tasks have not successfully run at least so-and-so many minutes ago. The alerts will also come in via Sentry, but you can also send them to email addresses with the config setting FLEXMEASURES_MONITORING_MAIL_RECIPIENTS. See Pull Request 146.

For illustration of the latter monitoring, here is one example of how we monitor tasks on a server ― the below is run in a cron script every hour:

flexmeasures monitor tasks --task get_weather_forecasts 60 --task get_recent_meter_data 6  --task import_epex_prices 1440

The first task (get_weather_forecasts) is actually supported within FlexMeasures, while the other two sit in plugins we wrote. 

Some other notable improvements