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

Function main

GPU-Virtual-Service/gpu-remoting/proxy_.py:218–250  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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