https://prefect.io logo
Title
m

Marcos

08/30/2022, 6:27 PM
Hi! I’ve searched in the docs but couldn’t find an answer so I’m asking here, is there a way to run a task even if a previous task fails? Here’s an example:
@flow
async def test():
    connected = await connect_db.submit()

    task1 = await db_stuff.submit(wait_for=[connected])
    await disconnect_db.submit(wait_for=[task1])
If
db_stuff
fails,
disconnect_db
never is executed but I’d like it to do it
👀 1
1
b

Bianca Hoch

08/30/2022, 8:31 PM
Hi Marcos, this discourse article might be useful. There is an example which shows a task running regardless of the upstream task's state.
😛anda-dancing: 1
:upvote: 1