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

Method run

src/memos/context/context.py:224–241  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

222 self.main_context = get_current_context()
223
224 def run(self):
225 # Create a new RequestContext with the main thread's trace_id
226 if self.main_context:
227 # Copy the context data
228 child_context = RequestContext(
229 trace_id=self.main_trace_id,
230 api_path=self.main_api_path,
231 env=self.main_env,
232 user_type=self.main_user_type,
233 user_name=self.main_user_name,
234 )
235 child_context._data = self.main_context._data.copy()
236
237 # Set the context in the child thread
238 set_request_context(child_context)
239
240 # Run the target function
241 self.target(*self.args, **self.kwargs)
242
243
244class ContextThreadPoolExecutor(ThreadPoolExecutor):

Callers

nothing calls this directly

Calls 3

RequestContextClass · 0.85
set_request_contextFunction · 0.85
copyMethod · 0.45

Tested by

no test coverage detected