Skip to content

Feat: automation cross org skip notice - #2941

Open
BelhsanHmida wants to merge 7 commits into
mainfrom
feat/2914-cross-org-skip-notice-on-main
Open

BelhsanHmida wants to merge 7 commits into
mainfrom
feat/2914-cross-org-skip-notice-on-main

Conversation

@BelhsanHmida

@BelhsanHmida BelhsanHmida commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

When a run is skipped because the run it waits for failed in another organisation, or on a public asset, nobody in the skipped run's organisation hears about it: the failure is reported to the other organisation, or only to the host.
This PR reports such a skip in flexmeasures monitor automations. For example, a battery schedule waits for a price check on a public asset, and the price check fails: the battery's organisation now gets the battery schedule as skipped in its digest, with the battery report that waits for it listed underneath.

  • Report a run skipped because of a failed run in another organisation, or on a public asset, in the user digests (--notify-users) of the skipped run's organisation
  • Report only the first skipped run of each organisation along a chain, and list the runs of its organisation skipped after it underneath
    A chain that crosses into a third organisation is reported to each organisation separately, each digest listing only its own runs
  • Show the upstream run's error only to users who may read that automation (a public one, yes; another organisation's, usually not)
  • Leave out skips within one organisation (the failed run already reaches the same people), skips for an upstream whose failure is allowed for, and unmonitored automations
  • Still report a skip once its upstream automation is deleted, as the run records, when it is skipped, which failed upstreams are in another organisation
  • List these skips in the host digest too, and count them as reported (alerted_at) once that digest is sent, as with failed runs
  • Docs: when a skipped run is reported, and the monitor's help, messages and CLI docs now mention skipped runs next to failed ones
  • Added changelog item in documentation/changelog.rst

Look & Feel

A user digest in the price check example (subject: "Skipped runs of 1 automation"):

These automations on assets you look after have runs that were skipped, as an automation they wait for failed in another organisation, or on a public asset:

Automation 2 'Battery schedule' (mock-ingestion) on asset 1 'prosumer site' of organisation 'Test Prosumer Account':
  skipped once, last at 2026-08-05 01:00 UTC (run 2)
  because: Check prices (automation 1, run 1) failed.
  error of automation 1 'Check prices' on public asset 3 'public site': ValueError: The external system was unreachable.
  skipped as a result: automation 3 'Battery report' (once)

Each automation's runs are listed on the Automations page of its asset.

How to test

pytest flexmeasures/cli/tests/test_monitor_automation_skips_fresh_db.py flexmeasures/cli/tests/test_monitor_automations_fresh_db.py

Or by hand: make a public automation that fails, have an automation of your organisation wait for it, let both run, then run flexmeasures monitor automations --notify-users. Your organisation's account admins get the skipped run, and a second monitor run sends nothing.

Further Improvements

Related Items

Closes #2914
Part of #2519
Follow-up to #2706
Replaces #2940, which listed the commits of #2706 from before its squash merge


Sign-off

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on code under GPL or other license that is incompatible with FlexMeasures

…n a public asset, failed

The failed run is reported to its own organisation, or only to the host for a public asset,
so the organisation of the run waiting for it never hears why that run did not happen.
Only the first skipped run of each organisation along a chain is returned,
with the runs of its organisation skipped because of it.

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…he monitoring digests

Each skipped run says which run it was skipped for, with that run's error if the reader may see that automation,
and lists the runs of its organisation skipped after it.
The host digest lists them too, and they count as reported once it is sent, as failed runs do.

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
@read-the-docs-community

read-the-docs-community Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…or still reports it once they are deleted

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…per reported run

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
… and docs speak of failed runs

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
@BelhsanHmida
BelhsanHmida requested a review from Flix6x December 1, 2026 23:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tell an automation's owner when its run is skipped because of another organisation's automation

1 participant