MCPcopy Index your code
hub / github.com/agent0ai/agent-zero / kill

Method kill

helpers/defer.py:147–163  ·  view source on GitHub ↗

Kill the task and optionally terminate its thread.

(self, terminate_thread: bool = False)

Source from the content-addressed store, hash-verified

145 return await loop.run_in_executor(None, _get_result)
146
147 def kill(self, terminate_thread: bool = False) -> None:
148 """Kill the task and optionally terminate its thread."""
149 self.kill_children()
150 if self._future and not self._future.done():
151 self._future.cancel()
152
153 if terminate_thread and self.event_loop_thread.loop:
154 if self.event_loop_thread.loop.is_running():
155 try:
156 cleanup_future = asyncio.run_coroutine_threadsafe(
157 self._drain_event_loop_tasks(), self.event_loop_thread.loop
158 )
159 cleanup_future.result()
160 except Exception:
161 pass
162
163 self.event_loop_thread.terminate()
164
165 def kill_children(self) -> None:
166 for child in self.children:

Callers 15

__del__Method · 0.95
restartMethod · 0.95
close_runtime_syncFunction · 0.95
close_all_runtimes_syncFunction · 0.95
__init__Method · 0.45
removeMethod · 0.45
kill_processMethod · 0.45
cancel_running_taskMethod · 0.45
cleanup_parallel_jobFunction · 0.45
_cancel_jobFunction · 0.45
_terminate_processMethod · 0.45

Calls 5

kill_childrenMethod · 0.95
is_runningMethod · 0.45
resultMethod · 0.45
terminateMethod · 0.45

Tested by

no test coverage detected