MCPcopy Create free account
hub / github.com/MemTensor/MemOS / task_with_context

Function task_with_context

tests/api/test_thread_context.py:16–22  ·  view source on GitHub ↗

Test task function that returns task name and current context's trace_id

(task_name: str, delay: int)

Source from the content-addressed store, hash-verified

14
15
16def task_with_context(task_name: str, delay: int) -> tuple[str, str | None]:
17 """Test task function that returns task name and current context's trace_id"""
18 context = get_current_context()
19 trace_id = context.trace_id if context else None
20 logger.info(f"Task {task_name} running with trace_id: {trace_id}")
21 time.sleep(delay)
22 return task_name, trace_id
23
24
25def test_context_thread_propagation():

Callers

nothing calls this directly

Calls 2

get_current_contextFunction · 0.90
infoMethod · 0.65

Tested by

no test coverage detected