Hi, I was looking into the workflow code
https://github.com/run-llama/llama_index/blob/9083c6d199443076bc9d764022d4c98260d8e504/llama-index-core/llama_index/core/workflow/workflow.py#L317 and i would like to know what's should be the best way to clean up a task after an interruption.
I did prepare a sample, where the clean up of an interrupted task takes some time, in the output of
python clean_up_task_sample.py
you can see that
step1 finished
and
step2 finished
is printed after
finally
.
setup1 starting
setup2 starting
setup1 finished
setup2 finished
step1 starting
step2 starting
step1 finishing
step2 finishing
except
finally
step1 finished
step2 finished
loop 0
loop 1
loop 2
i did tried adding
await asyncio.gather(*unfinished, return_exceptions=True)
after the tasks are cancelled, and that fixed the issue, but maybe
wait_for(asyncio.gather(
could make more sense to avoid blocking to long.
Should i maybe open a Feature Request or a Bug Report?
Thanks