Skip to content

Commit 36e84e6

Browse files
Bihan  RanaBihan  Rana
authored andcommitted
Clean development code
1 parent b32c8dd commit 36e84e6

6 files changed

Lines changed: 3 additions & 29 deletions

File tree

gateway/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ requires-python = ">=3.10"
1111
dynamic = ["version"]
1212
dependencies = [
1313
# release builds of dstack-gateway depend on a PyPI version of dstack instead
14-
"dstack[gateway] @ git+https://github.com/Bihan/dstack.git@add_sglang_router_minimal_support",
14+
"dstack[gateway] @ git+https://github.com/dstackai/dstack.git@master",
1515
]
1616

1717
[tool.setuptools.package-data]

src/dstack/_internal/core/backends/base/compute.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -982,12 +982,7 @@ def get_dstack_gateway_wheel(build: str) -> str:
982982
r.raise_for_status()
983983
build = r.text.strip()
984984
logger.debug("Found the latest gateway build: %s", build)
985-
# return f"{base_url}/dstack_gateway-{build}-py3-none-any.whl"
986-
# For testing
987-
logger.debug(
988-
"Using test gateway wheel: https://bihan-test-bucket.s3.eu-west-1.amazonaws.com/dstack_gateway-0.0.0-py3-none-any.whl"
989-
)
990-
return "https://bihan-test-bucket.s3.eu-west-1.amazonaws.com/dstack_gateway-0.0.0-py3-none-any.whl"
985+
return f"{base_url}/dstack_gateway-{build}-py3-none-any.whl"
991986

992987

993988
def get_dstack_gateway_commands() -> List[str]:

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class GatewayCertificate(CoreModel):
4444
]
4545

4646

47-
# https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/proxy/gateway/resources/nginx/service.jinja2
4847
class GatewayConfiguration(CoreModel):
4948
type: Literal["gateway"] = "gateway"
5049
name: Annotated[Optional[str], Field(description="The gateway name")] = None

src/dstack/_internal/proxy/gateway/routers/registry.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
from dstack._internal.proxy.gateway.services.nginx import Nginx
1414
from dstack._internal.proxy.lib.deps import get_service_connection_pool
1515
from dstack._internal.proxy.lib.services.service_connection import ServiceConnectionPool
16-
from dstack._internal.utils.logging import get_logger
1716

1817
router = APIRouter(prefix="/{project_name}")
19-
logger = get_logger(__name__)
2018

2119

2220
@router.post("/services/register")
@@ -27,7 +25,6 @@ async def register_service(
2725
nginx: Annotated[Nginx, Depends(get_nginx)],
2826
service_conn_pool: Annotated[ServiceConnectionPool, Depends(get_service_connection_pool)],
2927
) -> OkResponse:
30-
logger.debug(f"[SglangRouterTesting] Gateway API Reception Router: {body.router}")
3128
await registry_services.register_service(
3229
project_name=project_name.lower(),
3330
run_name=body.run_name.lower(),

src/dstack/_internal/proxy/gateway/services/nginx.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,12 @@ def __init__(self, conf_dir: Path = Path("/etc/nginx/sites-enabled")) -> None:
8282
async def register(self, conf: SiteConfig, acme: ACMESettings) -> None:
8383
logger.debug("Registering %s domain %s", conf.type, conf.domain)
8484
conf_name = self.get_config_name(conf.domain)
85-
logger.debug(f"[SglangRouterTesting] Register Conf object dict: {conf.dict()}")
8685
async with self._lock:
8786
if conf.https:
8887
await run_async(self.run_certbot, conf.domain, acme)
8988
await run_async(self.write_conf, conf.render(), conf_name)
90-
# Start sglang-router if router is sglang
9189
if hasattr(conf, "router") and conf.router == "sglang":
9290
replicas = len(conf.replicas) if hasattr(conf, "replicas") and conf.replicas else 1
93-
logger.debug(
94-
f"[SglangRouterTesting] Starting sglang-router with {replicas} replicas"
95-
)
9691
await run_async(self.write_sglang_workers_conf, conf)
9792
await run_async(self.start_sglang_router, replicas)
9893

@@ -106,7 +101,6 @@ async def unregister(self, domain: str) -> None:
106101
async with self._lock:
107102
await run_async(sudo_rm, conf_path)
108103
workers_conf_path = self._conf_dir / f"sglang-workers.{domain}.conf"
109-
logger.debug(f"[SglangRouterTesting] Workers conf path: {workers_conf_path}")
110104
if workers_conf_path.exists():
111105
await run_async(sudo_rm, workers_conf_path)
112106
await run_async(self.stop_sglang_router)
@@ -122,26 +116,20 @@ def reload() -> None:
122116

123117
@staticmethod
124118
def start_sglang_router(replicas: int) -> None:
125-
"""Start sglang-router service, killing existing one if running."""
126119
try:
127-
# Kill existing sglang-router if running
128120
result = subprocess.run(
129121
["pgrep", "-f", "sglang::router"], capture_output=True, timeout=5
130122
)
131123
if result.returncode == 0:
132-
logger.info("Killing existing sglang-router...")
124+
logger.info("Stopping existing sglang-router...")
133125
subprocess.run(["pkill", "-f", "sglang::router"], timeout=5)
134-
# Wait a moment for the process to terminate
135126
import time
136127

137128
time.sleep(1)
138-
139-
# Generate worker URLs based on replica count
140129
worker_urls = []
141130
for i in range(1, replicas + 1):
142131
worker_urls.append(f"http://127.0.0.1:{10000 + i}")
143132

144-
# Start sglang-router with system-wide installation
145133
logger.info(f"Starting sglang-router with {replicas} replicas...")
146134
cmd = (
147135
[

src/dstack/_internal/server/services/services/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ async def _register_service_in_gateway(
8383
gateway_configuration = get_gateway_configuration(gateway)
8484
service_https = _get_service_https(run_spec, gateway_configuration)
8585
router = gateway_configuration.router
86-
logger.debug(f"[SglangRouterTesting] Configuration parsing: {router}")
87-
logger.debug(
88-
f"[SglangRouterTesting] Configuration parsing dict: {gateway_configuration.dict()}"
89-
)
9086
service_protocol = "https" if service_https else "http"
9187

9288
if service_https and gateway_configuration.certificate is None:
@@ -112,7 +108,6 @@ async def _register_service_in_gateway(
112108
conn = await get_or_add_gateway_connection(session, gateway.id)
113109
try:
114110
logger.debug("%s: registering service as %s", fmt(run_model), service_spec.url)
115-
logger.debug(f"[SglangRouterTesting] Service Registration Router: {router}")
116111
async with conn.client() as client:
117112
await client.register_service(
118113
project=run_model.project.name,

0 commit comments

Comments
 (0)