Hey ! Quick question regarding automations in Pref...
# ask-community
j
Hey ! Quick question regarding automations in Prefect Cloud. It seems the automation isn't triggered if the flow fails to start, for instance if it couldn't be found in the registered storage. Is it expected ? Is that kind of automation part of the agent automation, and not the flow run ?
k
Hi @Jocelyn Boullier! I’ll ask the team about this. What were you trying to do with the automation?
j
Simply write a message on Slack if the flow failed or succeed
Thanks for looking into this 🙂
Actually my automation doesn't seem to work at all. I'm using the same webhook URL used by the
slack_notifier
which is also configured, but only get one message, matching the one from
slack_notifier
and not the default one from the automation
k
Ah I see. There are separate automations for “the flow failed” and “the flow failed to start”. If the flow is not in storage, the flow run will fail. Which automation did you set?
j
Failed
, I'm not sure what state corresponds to
failed to start
?
k
Like there was no agent to pick it up
j
I mean in the automation creation panel
k
Gotcha ok. Will forward to the team. Thanks for all the info!
🙌 1
j
Hi @Jocelyn Boullier - Can I check I understand your issue correctly - you've got an automation set on your flow to notify you on slack when your flow has a failed run. But you now have a flow run in a failed state and you're not getting a slack notification?
j
Hi ! Two things: • My initial question was that I didn't see a slack notification when my flow went into a failed state because the flow couldn't be found. So I assumed that it wasn't "supported" by the automation of flow runs. • Now my issue is that the automation that should send a message when a flow is successful/failed/canceled doesn't run at all, and I don't know how to debug it. I have a slack notifier configured for my flows, using a team secret
SLACK_WEBHOOK_URL
, which works. But the automation one doesn't seem to work, even though it's using the same secret. I'm still curious about my first question, but the second one is the real problem
j
Hi @Jocelyn Boullier - For your first question - if it is in a failed state that automation should work. For your second question, first step - can you check the notification tile on the dashboard and see if there's a Prefect Action Failed Notification?
j
Oh, I completely missed that tile ! Yes, there is.
but this is weird, since the webhook secret is working wih the
slack_notifier
but not here. I can't see the secret but I'm pretty sure it starts with
https
j
That is odd. Double checking that your slack_notifier is also using a secret from the UI (i.e. there's not one stored in your local config.toml?)
j
I dont have a
config.toml
and my Kubernetes cluster doesn't have this secret and there is no env variable loaded in the job template
I've edited the secret again with the URL, this time to be sure. I'll see what happens in the next run in our hour
j
Ok. Thanks. Please update us when that runs.
j
I must have done something wrong previously because now it works. Thanks for the help !
j
Great. Glad you got it working!
j
Actually now I'm wondering if it's possible to separate in the automation UI failure from the flow run from a failure from before that, e.g. a flow not found ? My use case is to have Prefect send a notification if the flow couldn't be found (since we can't do that in the flow itself) while handling in code the more traditional flow run failures due to a task failure
j
Interesting question! I don't think there is but I like the idea so going to double check with the team.
j
Great, thanks 🙂
j
Hi @Jocelyn Boullier the immediate answer is that it's not possible to separate them on our side. I’ll put it forward as a suggestion for future so let me know if you have any other thoughts on it.
j
Got it, thank you ! I don't think I have any other thoughts on that topic. The main goal is just to be able to be notified when a run fails outside of a flow run.
👍 1