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

Method cleanup

lightx2v/server/services/distributed_utils.py:60–83  ·  view source on GitHub ↗
(self, timeout: int = 2)

Source from the content-addressed store, hash-verified

58 return False
59
60 def cleanup(self, timeout: int = 2):
61 self._shutting_down = True
62 self.is_initialized = False
63 self.task_pg = None
64
65 if not dist.is_initialized():
66 return
67
68 import threading
69
70 def _destroy():
71 try:
72 dist.destroy_process_group()
73 except Exception:
74 pass
75
76 t = threading.Thread(target=_destroy, daemon=True)
77 t.start()
78 t.join(timeout=timeout)
79
80 if t.is_alive():
81 logger.warning(f"Rank {self.rank} cleanup timed out, forcing exit")
82 else:
83 logger.info(f"Rank {self.rank} distributed environment cleaned up")
84
85 def barrier(self):
86 if self.is_initialized and dist.is_initialized():

Callers

nothing calls this directly

Calls 4

is_initializedMethod · 0.80
warningMethod · 0.80
infoMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected