MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / start

Method start

src/tool_system/task_manager.py:24–46  ·  view source on GitHub ↗
(self, *, name: str, target: Callable[[threading.Event], None])

Source from the content-addressed store, hash-verified

22 self._tasks: dict[str, ManagedTask] = {}
23
24 def start(self, *, name: str, target: Callable[[threading.Event], None]) -> ManagedTask:
25 task_id = str(uuid.uuid4())
26 stop_event = threading.Event()
27
28 def runner() -> None:
29 try:
30 target(stop_event)
31 finally:
32 with self._lock:
33 self._tasks.pop(task_id, None)
34
35 thread = threading.Thread(target=runner, name=f"tool-task:{name}:{task_id}", daemon=True)
36 task = ManagedTask(
37 task_id=task_id,
38 name=name,
39 started_at=time.time(),
40 stop_event=stop_event,
41 thread=thread,
42 )
43 with self._lock:
44 self._tasks[task_id] = task
45 thread.start()
46 return task
47
48 def stop(self, task_id: str) -> bool:
49 with self._lock:

Callers 6

_invoke_tool_callFunction · 0.45
_callFunction · 0.45
_launch_async_agentFunction · 0.45
spawn_background_bashFunction · 0.45
_run_rg_with_abortFunction · 0.45
start_eviction_sweeperFunction · 0.45

Calls 1

ManagedTaskClass · 0.85

Tested by

no test coverage detected