Creating an Asset Check Sensor to get Slack notification whenever an Asset Check fails #21281
NicolasGuary
started this conversation in
Show and tell
Replies: 1 comment
-
This is amazing! I had to make a few changes around the severity, but that's it. When I looked at the event I was getting I saw it as an attribute on event_specific_data, with the enum type. Thanks a ton for this! changes: asset_check_severity = dagster_event.event_specific_data.severity severity_emoji = ":warning:" if asset_check_severity == dagster.AssetCheckSeverity.WARN else ":x:" |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Following my current needs and after looking at the following discussion, I started working on sensors that would send a Slack notification if a check fails (it seems to be a native feature of Dagster Cloud / Dagster+, but needs custom code for OSS deployments).
To avoid managing event logs, I used simple
run_status_sensor
for bothSUCCESS
andFAILURE
states. It allows handling the job runs context only once in a quite simple manner.Here's the function that handles the events :
-> We get events from the context of the run and retrieve only
ASSET_CHECK_EVALUATION
As it also contains some logic related to the event's context, here's my current implementation of the slack message formatting :
Finally, here's how I defined two sensors (for both run failures and success) :
Hope this helps, feel free to use this code to fit your needs (for instance you can avoid posting if asset check is in warn state etc...)
Beta Was this translation helpful? Give feedback.
All reactions