flexmeasures.data.services.automations
Logic for running automations (see also the CLI command flexmeasures jobs run-automations).
Functions
- flexmeasures.data.services.automations.describe_cronstr(cronstr: str) str
Describe a cron string in natural language, e.g. “At 06:00”.
Explicitly renders times in 24-hour format, as cron-descriptor otherwise picks a format based on the system locale.
- flexmeasures.data.services.automations.floor_to_minute(dt: datetime) datetime
Floor a datetime to the minute, in the FLEXMEASURES_TIMEZONE.
- flexmeasures.data.services.automations.get_automation_job_stats(automation: Automation) dict[str, int]
Count the jobs created by this automation, per job status.
Note that jobs in Redis have a limited TTL, so this only counts fairly recent jobs.
- flexmeasures.data.services.automations.get_due_automations(now: datetime | None = None) list[Automation]
Return active automations whose cron string matches the given (or current) minute.
Cron strings are interpreted in the FLEXMEASURES_TIMEZONE.