MCPcopy Index your code
hub / github.com/shareAI-lab/learn-claude-code / claim_task

Function claim_task

s12_task_system/code.py:111–123  ·  view source on GitHub ↗
(task_id: str, owner: str = "agent")

Source from the content-addressed store, hash-verified

109
110
111def claim_task(task_id: str, owner: str = "agent") -> str:
112 task = load_task(task_id)
113 if task.status != "pending":
114 return f"Task {task_id} is {task.status}, cannot claim"
115 if not can_start(task_id):
116 deps = [d for d in task.blockedBy
117 if not _task_path(d).exists() or load_task(d).status != "completed"]
118 return f"Blocked by: {deps}"
119 task.owner = owner
120 task.status = "in_progress"
121 save_task(task)
122 print(f" \033[36m[claim] {task.subject} → in_progress (owner: {owner})\033[0m")
123 return f"Claimed {task.id} ({task.subject})"
124
125
126def complete_task(task_id: str) -> str:

Callers 1

run_claim_taskFunction · 0.70

Calls 5

existsMethod · 0.80
load_taskFunction · 0.70
can_startFunction · 0.70
_task_pathFunction · 0.70
save_taskFunction · 0.70

Tested by

no test coverage detected