MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / run_series

Function run_series

tests/repro/issue832_rss.py:59–90  ·  view source on GitHub ↗
(repo, cache, supervised)

Source from the content-addressed store, hash-verified

57
58
59def run_series(repo, cache, supervised):
60 env = dict(os.environ)
61 env["CBM_CACHE_DIR"] = cache
62 if supervised:
63 env.pop("CBM_INDEX_SUPERVISOR", None)
64 else:
65 env["CBM_INDEX_SUPERVISOR"] = "0" # in-process (pre-fix background behaviour)
66 env["CBM_INDEX_WORKER_TIMEOUT_S"] = "120"
67
68 proc = subprocess.Popen(
69 [BINARY], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
70 stderr=subprocess.DEVNULL, env=env, text=True, bufsize=1,
71 )
72
73 def rpc(obj):
74 proc.stdin.write(json.dumps(obj) + "\n")
75 proc.stdin.flush()
76 return proc.stdout.readline()
77
78 rpc({"jsonrpc": "2.0", "id": 0, "method": "initialize", "params": {}})
79 series = []
80 for k in range(CYCLES):
81 rpc({"jsonrpc": "2.0", "id": k + 1, "method": "tools/call",
82 "params": {"name": "index_repository",
83 "arguments": {"repo_path": repo, "mode": "fast"}}})
84 series.append(rss_kb(proc.pid))
85 try:
86 proc.stdin.close()
87 proc.wait(timeout=15)
88 except Exception:
89 proc.kill()
90 return series
91
92
93def main():

Callers 1

mainFunction · 0.85

Calls 3

rpcFunction · 0.85
rss_kbFunction · 0.85
closeMethod · 0.80

Tested by

no test coverage detected