has anybody setup slack messages for prefect from within a task, basically I am looping over some SQL table builds, and I wrap them in a try/except for each table. the try/except allows the task to continue running if any one table fails, but besides logging the warning, I don't get a slack notif for any of the individual tables if they fail... i have the slack notifs setup for the flow as a whole, and could always set them up with the native python slack integration, but was curious if anyone had set that up within prefect natively, thanks!
k
Kevin Kho
09/08/2021, 1:57 PM
Hey @Cory Jez, the easiest way to do this is to use the Prefect Slack Task and then use this task in another task by calling the
.run()
method manually.
❤️ 1
c
Cory Jez
09/08/2021, 2:00 PM
thanks @Kevin Kho
k
Kevin Kho
09/08/2021, 2:01 PM
Copy code
@task
def abc():
SlackTask(...).run()
of course!
c
chicago-joe
09/08/2021, 5:59 PM
Also I'd recommend creating a Prefect Secret with the slack channel url, that way you can use it in the slack task very easily!
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.