Hi! I’m facing an issue where I can’t quite get th...
# ask-community
d
Hi! I’m facing an issue where I can’t quite get the Prefect Slack app connected to our Slack instance, but we do have our own hand-rolled Slack notifier that sends messages into a channel. I currently have a
SendSlackNotificationTask
task at the end of my (linear and static) flow, but it fails to run if any of its parents failed. This means the notification won’t run, so I won’t know things failed, which is probably bad. My question: is there a way to make a task run regardless of its parent tasks’ states? I know there’s the
case
option — is that a better fit here? Can
case
work with a task’s state?
a
Instead of a task, could you put it in a state handler?
d
Ah, yeah! So that would get passed to this
SendSlackNotificationTask(..., state_handlers=[slack_state_handler])
, and
slack_state_handler
specifically checks for the success and failed states? Referencing here: https://docs.prefect.io/core/concepts/notifications.html#state-handlers
Or…maybe it would be on the flow object itself?
a
Since you want to send the Slack notifications at the end of the flow, I would expect it to be a flow state handler instead.
🙌 1
d
I’ll give that a shot — thanks @Amanda Wee!
k
The state makes sense because normally people add some information to the Slack message, but about making a task run all the time, the answer would be in triggers and setting a trigger to
always_run
so that it runs even if upstream tasks fail.
d
Gotcha! I think going down the vein of state handlers, I was looking for the
terminal_state_handler
argument to
Flow
— thanks @Kevin Kho!