Skip to content

Commit 6510956

Browse files
Bihan  RanaBihan  Rana
authored andcommitted
Test sglang router per service implementation
1 parent b278b1a commit 6510956

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/dstack/_internal/proxy/gateway/model_routers/sglang_new.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ def start(self) -> None:
4848
# Use Python from the active venv
4949
venv_python = DSTACK_DIR_ON_GATEWAY / version / "bin" / "python3"
5050

51+
# Calculate prometheus port: router_port + 10000
52+
# Router ports: 20000-24999, Prometheus ports: 30000-34999
53+
prometheus_port = self.context.port + 10000
54+
5155
cmd = [
5256
str(venv_python),
5357
"-m",
@@ -56,6 +60,8 @@ def start(self) -> None:
5660
"0.0.0.0", # Bind to all interfaces (nginx connects via 127.0.0.1)
5761
"--port",
5862
str(self.context.port),
63+
"--prometheus-port",
64+
str(prometheus_port),
5965
# Note: No --enable-igw flag for this router type
6066
"--log-level",
6167
self.context.log_level,
@@ -75,7 +81,11 @@ def start(self) -> None:
7581
if not self.is_running():
7682
raise Exception(f"Failed to start sglang router on port {self.context.port}")
7783

78-
logger.info("Sglang router started successfully on port %s", self.context.port)
84+
logger.info(
85+
"Sglang router started successfully on port %s (prometheus on %s)",
86+
self.context.port,
87+
prometheus_port,
88+
)
7989

8090
except Exception as e:
8191
logger.error(f"Failed to start sglang-router-new: {e}")

0 commit comments

Comments
 (0)