Hi, I'm currently running a flow with a task that...
# ask-community
s
Hi, I'm currently running a flow with a task that is not critical, and often fails. I want to use a control flow task to execute the subsequent tasks with different inputs depending on whether the previous task failed. I could wrap the whole task in a try catch block and return a boolean success value, but I also want the task failure to appear in the prefect UI, along with the error message. Is there any way to branch based on the state of a task, as opposed to the value of the result?
1
s
s
Thanks Spencer, I initially tried implementing this with two tasks with all_successful, and any_failed triggers. The problem I have is that this then causes one of the tasks to trigger fail. Is there a way to skip a task based on triggers? I was considering writing a new trigger that instead raised a SKIP signal. I think this idea was discussed in PIN-15 but rejected. Failing that, I guess my best option is to create a terminal task with an any_successful trigger so that the terminal state of the flow is successful so long as one of the two tasks has run.