MCPcopy Create free account
hub / github.com/KnowledgeXLab/LeanRAG / __init__

Method __init__

CommonKG/llm_infer.py:17–28  ·  view source on GitHub ↗
(self, ports, gpus, base_url, startup_delay=5)

Source from the content-addressed store, hash-verified

15
16class InstanceManager:
17 def __init__(self, ports, gpus, base_url, startup_delay=5):
18 self.ports = ports
19 self.gpus = gpus
20 self.base_url = base_url
21 self.instances = []
22 self.lock = threading.Lock()
23 self.current_instance = 0 # 用于轮询策略
24
25 for port, gpu in zip(self.ports, self.gpus):
26 self.start_instance(gpu, port)
27 self.instances.append({"port": port, "load": 0})
28 time.sleep(startup_delay) # 等待所有实例启动
29
30 def start_instance(self, num, port):
31 """启动ollama实例在特定GPU和端口上"""

Callers

nothing calls this directly

Calls 1

start_instanceMethod · 0.95

Tested by

no test coverage detected