使用轮询策略获取一个可用的实例
(self)
| 35 | # subprocess.Popen(cmd, shell=True, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL) |
| 36 | |
| 37 | def get_available_instance(self): |
| 38 | """使用轮询策略获取一个可用的实例""" |
| 39 | with self.lock: |
| 40 | instance = self.instances[self.current_instance] |
| 41 | self.current_instance = (self.current_instance + 1) % len(self.instances) |
| 42 | return instance["port"] # 返回端口 |
| 43 | |
| 44 | def generate_text(self, prompt, model="qwen:72b", temperature=0): |
| 45 | """发送请求到选择的实例""" |
no outgoing calls
no test coverage detected