Sowmiya Anand
01/24/2024, 9:14 PMMarvin
01/24/2024, 9:14 PMon_failure
hooks.
The example given in the documentation shows how to define a notification function that is executed when a flow enters a Failed
state:
python
from prefect import flow
from prefect.blocks.core import Block
from prefect.settings import PREFECT_API_URL
def notify_slack(flow, flow_run, state):
slack_webhook_block = Block.load("slack-webhook/my-slack-webhook")
# ... code to send a notification to Slack ...
As far as the examples show, the function for the hook typically takes predefined arguments such as flow
, flow_run
, and state
. Custom messages or other arguments are not explicitly mentioned in this context.
For specific use cases or features not covered in the documentation, a richer understanding can sometimes be gleaned from the discussion on the project's GitHub repository or from asking the Prefect community directly. If you would like, I can search the GitHub issues for any related discussions that might provide further insight.Kevin Grismore
01/24/2024, 9:18 PM