@Marvin How do i specify an exception handler for all of my flows? I'd like to catch exceptions and send them to slack
m
Marvin
11/03/2023, 6:48 PM
To specify an exception handler for all of your flows, you can create a new logging handler. The
handlers
section of the default
logging.yml
shows the existing log handlers: the
console
handler, and the
prefect server
handler that sends logs to the API. You can add a new handler here for handling exceptions.
To send these exceptions to Slack, you can configure a notification in the Prefect server. Go to the Notifications page and select Create Notification or the + button. You can choose which run states should trigger a notification, tags to filter which flow runs are covered by the notification, and whether to send a Slack message. For Slack notifications, the configuration requires webhook credentials for your Slack and the channel to which the message is sent.
Here are the resources for more details:
- How to stream prefect logs to a file
- Prefect Notifications Guide
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.