How it works
- Fetch all pipeline entries from Supersonic.
- Load the previous state from a local JSON file.
- Compare: find entries where the stage changed.
- Post a Slack message for each change.
- Save the current state for the next run.
The script
Setup
1
Install dependencies
2
Set environment variables
3
Run once to initialize state
The first run creates the state file. No notifications are sent since there’s nothing to compare against.Check that the state file was created:
4
Schedule with cron
Run every 5 minutes:
Sending email instead of Slack
Replace thenotify_slack function with an email sender. Here’s one using smtplib:
The state file stores one snapshot of all entry stages. If the script misses a run (e.g., the machine was off), it will detect changes on the next run. It won’t detect intermediate stage changes that happened between runs.