MCPcopy Create free account
hub / github.com/blacklanternsecurity/bbot / cancel_task

Method cancel_task

bbot/core/engine.py:654–668  ·  view source on GitHub ↗
(self, client_id)

Source from the content-addressed store, hash-verified

652 return set()
653
654 async def cancel_task(self, client_id):
655 parent_task = self.tasks.pop(client_id, None)
656 if parent_task is None:
657 return
658 parent_task, _cmd, _args, _kwargs = parent_task
659 self.engine_debug(f"{self.name}: Cancelling client id {client_id} (task: {parent_task})")
660 parent_task.cancel()
661 child_tasks = self.child_tasks.pop(client_id, set())
662 if child_tasks:
663 self.engine_debug(f"{self.name}: Cancelling {len(child_tasks):,} child tasks for client id {client_id}")
664 for child_task in child_tasks:
665 child_task.cancel()
666
667 for task in [parent_task] + list(child_tasks):
668 await self._await_cancelled_task(task)
669
670 async def _await_cancelled_task(self, task):
671 try:

Callers 2

workerMethod · 0.95
cancel_all_tasksMethod · 0.95

Calls 5

_await_cancelled_taskMethod · 0.95
setFunction · 0.85
popMethod · 0.80
engine_debugMethod · 0.80
cancelMethod · 0.80

Tested by

no test coverage detected