From c2d8a45a07be3e2742c7b04f610aec96c37404f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Fri, 24 Jan 2025 18:13:18 -0800 Subject: [PATCH] runner: warn about remaining dangling tasks --- src/pipecat/pipeline/runner.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pipecat/pipeline/runner.py b/src/pipecat/pipeline/runner.py index 62e9e5e6f..8cdfc3eaa 100644 --- a/src/pipecat/pipeline/runner.py +++ b/src/pipecat/pipeline/runner.py @@ -10,7 +10,7 @@ import signal from loguru import logger from pipecat.pipeline.task import PipelineTask -from pipecat.utils.utils import obj_count, obj_id +from pipecat.utils.utils import current_tasks, obj_count, obj_id class PipelineRunner: @@ -33,6 +33,7 @@ class PipelineRunner: # everything gets cleaned up nicely. if self._sig_task: await self._sig_task + self._print_dangling_tasks() logger.debug(f"Runner {self} finished running {task}") async def stop_when_done(self): @@ -56,5 +57,10 @@ class PipelineRunner: logger.warning(f"Interruption detected. Canceling runner {self}") await self.cancel() + def _print_dangling_tasks(self): + tasks = [t.get_name() for t in current_tasks()] + if tasks: + logger.warning(f"Dangling tasks detected: {tasks}") + def __str__(self): return self.name