in aidial_sdk/utils/_cancel_scope.py [0:0]
def _on_task_done(self, task):
self._tasks.discard(task)
if (
self._on_completed_fut is not None
and not self._on_completed_fut.done()
and not self._tasks
):
self._on_completed_fut.set_result(True)
# If any of the tasks was cancelled, cancel all the tasks
if task.exception() is not None:
self._cancel_tasks()