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

Method parallel

src/workflow/runtime.py:229–247  ·  view source on GitHub ↗
(self, items)

Source from the content-addressed store, hash-verified

227 return result
228
229 async def parallel(self, items) -> list:
230 items = list(items)
231 if len(items) > MAX_ITEMS_PER_CALL:
232 self._close_coroutines(items)
233 raise WorkflowError(
234 f"parallel() received {len(items)} items; the per-call cap is {MAX_ITEMS_PER_CALL}"
235 )
236 base = current_branch().path + (current_branch().next_slot(),)
237
238 async def guarded(index: int, item):
239 token = use_branch(base + (index,))
240 try:
241 return await await_item(item)
242 except Exception:
243 return None # the barrier never rejects
244 finally:
245 reset_branch(token)
246
247 return list(await asyncio.gather(*(guarded(i, it) for i, it in enumerate(items))))
248
249 async def pipeline(self, items, *stages) -> list:
250 items = list(items)

Callers

nothing calls this directly

Calls 5

_close_coroutinesMethod · 0.95
WorkflowErrorClass · 0.85
current_branchFunction · 0.85
next_slotMethod · 0.80
guardedFunction · 0.50

Tested by

no test coverage detected