jack
03/23/2023, 6:00 PMChris White
03/23/2023, 7:32 PMjack
03/23/2023, 8:34 PMon_completion
and on_failure
callback to point to a function send_slack_message
We wanted the same functionality for on_start
, but since it doesn't exist yet, I've added these lines at the top of the flow to manually call send_slack_message
using the same signature as when the callback happens.
context = get_run_context()
send_slack_message(context.flow, context.flow_run, context.flow_run.state)
It would be tidier for this use case if the on_start
callback worked. It seems odd to call a callback manually.
With prefect v1 we used the same callback for any state change. Then we got slack messages for retries as well.