https://prefect.io logo
Title
j

Jessica Smith

02/06/2023, 5:16 PM
Prefect V2 question - I am trying to use try/except/finally, but I'm having trouble combining both "do not run until all of the tasks in the Try block have ran" and "run at the end, no matter what". I'm using
wait_for
, because without that the tasks in the Finally block ran immediately. But with
wait_for
, the tasks in the Finally block do not run if something has failed.
j

James Sopkin

02/06/2023, 5:20 PM
Hi Jessica, by default tasks run concurrently and that is probably why you had tasks in the finally block running before the try block was completed. Perhaps you could refactor some of your tasks to return a bool(like False if certain condition is not met) rather than a Failed state