flexmeasures.data.services.job_cache

Logic around storing and retrieving jobs from redis cache.

Classes

class flexmeasures.data.services.job_cache.JobCache(connection: Redis)

Class is used for storing jobs and retrieving them from redis cache. Need it to be able to get jobs for particular asset (and display them on status page). Keeps cache up to date by removing jobs that are not found in redis - were removed by TTL. Stores jobs by asset or sensor id, queue and asset or sensor type, cache key can look like this

  • forecasting:sensor:1 (forecasting jobs can be stored by sensor only)

  • scheduling:sensor:2

  • scheduling:asset:3

__init__(connection: Redis)

Exceptions

exception flexmeasures.data.services.job_cache.NoRedisConfigured(message='Redis not configured')