[Config] msgspec.Struct for the config tier (#38753)

This commit is contained in:
Cheng Wan
2026-09-09 19:41:19 -07:00
committed by GitHub
parent 106cc561f9
commit f1a512c51c
44 changed files with 328 additions and 210 deletions
@@ -6,6 +6,8 @@ import warnings
from typing import Dict, List, Optional, Union
import aiohttp
import msgspec
import msgspec.structs
import requests
from sglang.lang.backend.base_backend import BaseBackend
@@ -383,7 +385,12 @@ class Runtime:
# Pre-allocate a port before building the config, so the config is born
# with the port this runtime will serve on.
requested_port = kwargs.pop(
"port", ServerArgs.__dataclass_fields__["port"].default
"port",
next(
f.default
for f in msgspec.structs.fields(ServerArgs)
if f.name == "port"
),
)
for port in range(requested_port, 40000):
if is_port_available(port):