https://prefect.io logo
y

Yusuf Khan

01/23/2022, 9:42 PM
Hey, I'm reading about state handlers and I understand how to use them to send a slack notification if a task fails. I'm wondering how I can do something like: task 1 - Check if network connection is healthy task 1.1 - If network connection is healthy then go do the rest of the tasks task 1.2 - If network connection is not healthy then reset connection and return to task 1 task 2 - Something task 3 - Something task 4 - Something The issue I'm trying to workaround is I have a task running on a raspberry pi, and the network keeps giving out, and I don't want to blindly reset it each time, rather I'd prefer to check if its on, then reset it if needed. I saw tasks can be triggered based on "all_failed", "any_failed" etc. But I guess in this scenario I only care if the one that directly precedes it failed or not.
a

Anna Geller

01/23/2022, 9:51 PM
Prefect has special tasks to build conditional logic. You can build a branching logic based on the value returned by some task e.g. tasks checking the network connection. Alternatively, as you suggested, you can leverage triggers to launch some tasks only e.g. if some tasks failed. I will share some docs links soon.
y

Yusuf Khan

01/23/2022, 9:52 PM
Thank you that would be great! I'm sort of diving in the deep end then figuring stuff out to harden the flows
šŸ‘ 1
a

Anna Geller

01/23/2022, 9:53 PM
5 Views