mirror of
https://github.com/hasso5703/alzeo.git
synced 2026-12-06 12:54:19 +01:00
torch's TCPStore, the default rendezvous of an engine of one process, listened on every interface whatever address it was given: the 27B lane on *:23906, no key. SGLANG_DISTRIBUTED_INIT_METHOD_OVERRIDE=file:///tmp/sglang-rdv puts it in a file of the container, new at each start, in all four starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55 lines
2.8 KiB
Python
55 lines
2.8 KiB
Python
#!/usr/bin/env python3
|
|
"""The SGLang text engines open no port for their rendezvous (2026-10-30).
|
|
|
|
An SGLang engine of one process still sets torch.distributed up, by default through a TCPStore at
|
|
tcp://127.0.0.1:<a free port>, and torch makes that store listen on every interface whatever address
|
|
it is given: the 27B lane, its container on the host's network, listened on *:23906 with no key on
|
|
the reference box, which has no firewall. Both pinned images read SGLANG_DISTRIBUTED_INIT_METHOD_OVERRIDE
|
|
(srt/distributed/bootstrap.py, _resolve_dist_init_method; read in the 27B's v0.5.22 and the flash lane's
|
|
nightly on 2026-10-30): set to file:///tmp/sglang-rdv, the rendezvous goes through a file in the
|
|
container, which --rm makes new at each start, and no port opens for it. The 27B lane started that way
|
|
with nothing listening past loopback that FP4-Local alone did not have, and answered (2026-10-30).
|
|
"""
|
|
import pathlib
|
|
import unittest
|
|
|
|
REPO = pathlib.Path(__file__).resolve().parents[1]
|
|
FLAG = "-e SGLANG_DISTRIBUTED_INIT_METHOD_OVERRIDE=file:///tmp/sglang-rdv "
|
|
|
|
|
|
def sglang_starts():
|
|
"""Every file of the repo that starts an SGLang text engine."""
|
|
return sorted(p.name for p in [*REPO.glob("*.template"), REPO / "run.sh"]
|
|
if "sglang.launch_server" in p.read_text())
|
|
|
|
|
|
class EveryEngineStartTakesTheFileRendezvous(unittest.TestCase):
|
|
def test_the_starts_are_the_ones_this_test_knows(self):
|
|
# a new SGLang lane is held to it as soon as its unit exists
|
|
self.assertEqual(sglang_starts(), ["qwen38-flash-launch.sh.template", "qwen38-sglang-1m.service.template",
|
|
"qwen38-sglang-64.service.template", "qwen38-sglang.service.template",
|
|
"run.sh"])
|
|
|
|
def test_each_docker_run_passes_it_once_with_a_fresh_container(self):
|
|
for name in sglang_starts():
|
|
with self.subTest(name=name):
|
|
text = (REPO / name).read_text()
|
|
run = text[text.index("docker run"):]
|
|
self.assertEqual(run.count(FLAG), 1)
|
|
# the file is the container's own: new at each start, never one a mount carries over
|
|
self.assertIn("docker run --rm ", text)
|
|
self.assertNotRegex(run, r"-v [^ ]*:/tmp[ /:]")
|
|
|
|
def test_the_units_say_why(self):
|
|
for name in sglang_starts():
|
|
if name == "run.sh":
|
|
continue # verbatim the native unit's docker run (CI checks it)
|
|
with self.subTest(name=name):
|
|
text = (REPO / name).read_text()
|
|
self.assertIn("SGLANG_DISTRIBUTED_INIT_METHOD_OVERRIDE: the rendezvous of the engine's one process",
|
|
text[:text.index("docker run")])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|