Bryan
03/11/2024, 5:10 PMKevin Grismore
03/11/2024, 5:12 PMBryan
03/11/2024, 5:14 PMBryan
03/11/2024, 5:14 PMKevin Grismore
03/11/2024, 5:14 PMBryan
03/11/2024, 5:15 PMKevin Grismore
03/11/2024, 5:17 PMBryan
03/11/2024, 5:18 PMKevin Grismore
03/11/2024, 5:18 PMemit_event
https://docs.prefect.io/latest/cloud/events/#emit-custom-events-from-python-codeKevin Grismore
03/11/2024, 5:19 PMBryan
03/11/2024, 5:19 PMKevin Grismore
03/11/2024, 5:25 PMfrom prefect import flow, get_run_logger
from prefect.events import emit_event
@flow
def warning_event():
# something acceptably bad happened
get_run_logger().warning("This is a warning")
emit_event(event="custom_events.logging.Warning", resource={"prefect.resource.id": "custom_events.event"})
I see it in my event feed, click on it, then click the three dots and click "Automate"Kevin Grismore
03/11/2024, 5:26 PMBryan
03/11/2024, 5:26 PMBryan
03/13/2024, 1:05 AM{
"match": {
"prefect.resource.id": "test.dbt.SOME_DBT_TEST",
"payload.environment": "dev"
},
"match_related": {},
"after": [],
"expect": [
"custom_events.logging.dbt_warning"
],
"for_each": [],
"posture": "Reactive",
"threshold": 1,
"within": 0
}