File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -383,6 +383,20 @@ async def cancel(self):
383383 """Stops the running pipeline immediately."""
384384 await self ._cancel ()
385385
386+ async def force_cancel (self ):
387+ """Forcefully cancel the task and any running subtasks."""
388+ logger .debug (f"Force canceling task { self } triggered" )
389+ try :
390+ await self .cancel ()
391+ except Exception as e :
392+ logger .warning (f"Error calling pipecat task cancel { self } : { e } " )
393+
394+ for task in self ._task_manager .current_tasks ():
395+ try :
396+ await self ._task_manager .cancel_task (task )
397+ except Exception as e :
398+ logger .warning (f"Error canceling task { self } : { e } " )
399+
386400 async def run (self , params : PipelineTaskParams ):
387401 """Starts and manages the pipeline execution until completion or cancellation."""
388402 if self .has_finished ():
You can’t perform that action at this time.
0 commit comments