support MPServer and embedded server for granian to enable muti tokenizer worker (#28573)

This commit is contained in:
Rain Jiang
2026-06-18 17:59:12 -07:00
committed by GitHub
parent ea407df4b0
commit ef01618dfb
5 changed files with 131 additions and 128 deletions
@@ -27,8 +27,8 @@ try:
except ImportError:
_HAS_GRANIAN = False
register_cuda_ci(est_time=52, stage="base-b", runner_config="1-gpu-small")
register_amd_ci(est_time=52, suite="stage-b-test-1-gpu-small-amd")
register_cuda_ci(est_time=150, stage="base-b", runner_config="1-gpu-small")
register_amd_ci(est_time=150, suite="stage-b-test-1-gpu-small-amd")
@unittest.skipUnless(_HAS_GRANIAN, "granian not installed (pip install sglang[http2])")
@@ -109,5 +109,26 @@ class TestHTTP2Server(CustomTestCase):
)
@unittest.skipUnless(_HAS_GRANIAN, "granian not installed (pip install sglang[http2])")
class TestHTTP2ServerMultiTokenizer(TestHTTP2Server):
"""Same checks as TestHTTP2Server but with multiple tokenizer workers.
With --tokenizer-worker-num > 1 the HTTP/2 server is served by Granian's
multi-process server (instead of the single-process embedded server), so
this exercises the multi-worker code path.
"""
@classmethod
def setUpClass(cls):
cls.model = DEFAULT_SMALL_MODEL_NAME_FOR_TEST
cls.base_url = DEFAULT_URL_FOR_TEST
cls.process = popen_launch_server(
cls.model,
cls.base_url,
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
other_args=["--enable-http2", "--tokenizer-worker-num", "2"],
)
if __name__ == "__main__":
unittest.main(verbosity=3)