MCPcopy Create free account
hub / github.com/ModelEngine-Group/flexai / main

Function main

GPU-Virtual-Service/gpu-remoting/proxy.py:217–249  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

215 if clientId2gpuInfos[clientID]['usedNum'] == 0:
216 del clientId2gpuInfos[clientID]
217 logging.info(f"Client#{clientID} released all GPU resources")
218
219def main():
220 config = load_runtime_config()
221
222 dpcIp = config['DispatcherConfig']['dpcIp_']
223 dpcPort = config['DispatcherConfig']['dpcPort_']
224 listenIp = config['ClientConfig']['proxyIp_']
225 listenPort = config['ClientConfig']['proxyPort_']
226
227 proxy = connect_to_dispatcher(dpcIp, dpcPort)
228 if proxy is None:
229 return
230
231 logging.info(f"Connected to dispatcher({dpcIp}:{dpcPort})")
232 proxy_lock = threading.Lock()
233
234 listen_proxy = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
235 listen_proxy.bind((listenIp, listenPort))
236 listen_proxy.listen()
237 logging.info(f"Listening on {listenIp}:{listenPort}")
238
239 try:
240 while True:
241 conn, addr = listen_proxy.accept()
242 logging.debug(f"Accepted connection from {addr}")
243 threading.Thread(target=handle_client_worker, args=(conn, addr, proxy, proxy_lock)).start()
244 except KeyboardInterrupt:
245 logging.info("Shutting down...")
246 listen_proxy.close()
247 proxy.close()
248
249 proxy.close()
250
251if __name__ == "__main__":
252 main()

Callers 1

proxy.pyFile · 0.70

Calls 6

LockMethod · 0.80
startMethod · 0.80
connect_to_dispatcherFunction · 0.70
loadMethod · 0.45
listenMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected