Skip to content

Commit 7285b30

Browse files
Bihan  RanaBihan  Rana
authored andcommitted
Test sglang router per service implementation
1 parent e6c2bcb commit 7285b30

File tree

6 files changed

+498
-39
lines changed

6 files changed

+498
-39
lines changed

src/dstack/_internal/core/models/routers.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@
99

1010
class RouterType(str, Enum):
1111
SGLANG = "sglang"
12+
SGLANG_DEPRECATED = "sglang_deprecated"
13+
SGLANG_NEW = "sglang_new"
1214
VLLM = "vllm"
1315

1416

1517
class SGLangRouterConfig(CoreModel):
18+
type: Literal["sglang_deprecated"] = "sglang_deprecated"
19+
policy: str = "cache_aware"
20+
21+
22+
class SGLangNewRouterConfig(CoreModel):
1623
type: Literal["sglang"] = "sglang"
1724
policy: str = "cache_aware"
1825

@@ -23,5 +30,5 @@ class VLLMRouterConfig(CoreModel):
2330

2431

2532
AnyRouterConfig = Annotated[
26-
Union[SGLangRouterConfig, VLLMRouterConfig], Field(discriminator="type")
33+
Union[SGLangRouterConfig, SGLangNewRouterConfig, VLLMRouterConfig], Field(discriminator="type")
2734
]

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22

33
from dstack._internal.core.models.routers import AnyRouterConfig
44
from dstack._internal.proxy.gateway.model_routers.sglang import SglangRouter
5+
from dstack._internal.proxy.gateway.model_routers.sglang_new import SglangRouterNew
56

67
from .base import Replica, Router, RouterContext
78

89

910
def get_router(router: AnyRouterConfig, context: Optional[RouterContext] = None) -> Router:
1011
"""Factory function to create a router instance from router configuration."""
1112
if router.type == "sglang":
13+
return SglangRouterNew(router=router, context=context)
14+
if router.type == "sglang_deprecated":
1215
return SglangRouter(router=router, context=context)
16+
if router.type == "sglang_new":
17+
return SglangRouterNew(router=router, context=context)
1318
raise ValueError(f"Router type '{router.type}' is not available")
1419

1520

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class SglangRouter(Router):
1919
"""SGLang router implementation using IGW (Inference Gateway) mode for multi-model serving."""
2020

21-
TYPE = "sglang"
21+
TYPE = "sglang_deprecated"
2222

2323
def __init__(self, router: SGLangRouterConfig, context: Optional[RouterContext] = None):
2424
"""Initialize SGLang router.

0 commit comments

Comments
 (0)