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

Method encode_thread

lightx2v/disagg/conn.py:359–395  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

357 room_socket = self.get_or_create_room_socket(room, sender_rank_port)
358
359 def encode_thread():
360 while not stop_event.is_set():
361 try:
362 (
363 endpoint,
364 receiver_engine_rank_raw,
365 mooncake_session_id,
366 bootstrap_room,
367 transformer_ptrs,
368 ) = room_socket.recv_multipart()
369 except zmq.Again:
370 continue
371 receiver_engine_rank = int.from_bytes(receiver_engine_rank_raw, byteorder="big")
372 if bootstrap_room.decode("ascii") == "None":
373 continue
374 endpoint = endpoint.decode("ascii")
375 mooncake_session_id = mooncake_session_id.decode("ascii")
376 bootstrap_room = int(bootstrap_room.decode("ascii"))
377 transformer_ptrs = list(struct.unpack(f"{len(transformer_ptrs) // 8}Q", transformer_ptrs))
378 logger.info(
379 "Encoder received ZMQ: endpoint=%s session_id=%s room=%s receiver_engine_rank=%s transformer_ptrs=%s",
380 endpoint,
381 mooncake_session_id,
382 bootstrap_room,
383 receiver_engine_rank,
384 transformer_ptrs,
385 )
386 with self.pool_lock:
387 self.waiting_pool[bootstrap_room] = (
388 endpoint,
389 mooncake_session_id,
390 transformer_ptrs,
391 )
392 if bootstrap_room in self.data_args:
393 self.data_args[bootstrap_room].receiver_engine_rank = receiver_engine_rank
394 if self.transfer_event is not None:
395 self.transfer_event.set()
396
397 encode_worker = threading.Thread(target=encode_thread)
398 encode_worker.start()

Callers

nothing calls this directly

Calls 2

infoMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected