MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / serve

Method serve

lightx2v/disagg/services/instance_proxy.py:217–236  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

215 return {"ok": False, "error": f"unsupported command: {cmd}"}
216
217 def serve(self):
218 context = zmq.Context()
219 socket = context.socket(zmq.REP)
220 socket.bind(self.bind_addr)
221 try:
222 while self._running:
223 try:
224 msg = socket.recv_pyobj()
225 if not isinstance(msg, dict):
226 socket.send_pyobj({"ok": False, "error": "request must be a dict"})
227 continue
228 reply = self.handle(msg)
229 except Exception as exc:
230 reply = {"ok": False, "error": str(exc)}
231 socket.send_pyobj(reply)
232 finally:
233 socket.close(0)
234 context.term()
235 for pid in list(self._managed.keys()):
236 self._terminate_pid(pid, timeout_seconds=2.0)
237
238
239def main():

Callers 1

mainFunction · 0.95

Calls 5

handleMethod · 0.95
_terminate_pidMethod · 0.95
bindMethod · 0.80
closeMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected