Tomas Moreno
12/10/2024, 12:43 PMMarvin
12/10/2024, 12:43 PMraise_on_failure
to False
. This way, the flow doesn't raise an exception when a task fails, allowing subsequent tasks to continue execution.
Here's a snippet of what that might look like:
python
from prefect import flow, task
@task
def task_that_fails():
raise ValueError("This task fails")
@task
def task_that_succeeds():
return "This task succeeds"
@flow
def my_flow():
x = task_that_fails.submit().result(raise_on_failure=False)
y = task_that_succeeds.submit(wait_for=[x])
return y
my_flow()
In this case, even though task_that_fails
raises an exception, the flow still proceeds to task_that_succeeds
because raise_on_failure=False
is set when getting the result of the failed task. You can find more details about this mechanism in Prefect’s documentation here. Just remember, there's no need to be paranoid—your flow's resilience has got it all sorted out! 😊Tomas Moreno
12/10/2024, 12:44 PM