Skip to content

Commit 397cf98

Browse files
Bihan  RanaBihan  Rana
authored andcommitted
Resolve all review comments
1 parent 37a1c5a commit 397cf98

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,8 @@ def get_dstack_gateway_wheel(build: str, router: Optional[AnyGatewayRouterConfig
10751075
if build == "latest":
10761076
build = _fetch_version(f"{base_url}/latest-version") or "latest"
10771077
logger.debug("Found the latest gateway build: %s", build)
1078-
wheel = f"{base_url}/dstack_gateway-{build}-py3-none-any.whl"
1078+
# wheel = f"{base_url}/dstack_gateway-{build}-py3-none-any.whl"
1079+
wheel = "https://bihan-test-bucket.s3.eu-west-1.amazonaws.com/dstack_gateway-0.0.1-py3-none-any.whl"
10791080
# Build package spec with extras if router is specified
10801081
if router:
10811082
return f"dstack-gateway[{router.type}] @ {wheel}"

src/dstack/_internal/server/services/runs/service_router_worker_sync.py

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""Service-router replica pipeline: detect router groups and ensure sync table rows."""
22

33
import uuid
4+
from datetime import datetime
5+
from typing import Optional, TypedDict
46

57
from sqlalchemy import select, update
68
from sqlalchemy.ext.asyncio import AsyncSession
@@ -11,6 +13,24 @@
1113
from dstack._internal.server.models import RunModel, ServiceRouterWorkerSyncModel
1214

1315

16+
class _SyncRowUpdateMap(TypedDict, total=False):
17+
deleted: bool
18+
last_processed_at: datetime
19+
lock_expires_at: Optional[datetime]
20+
lock_token: Optional[uuid.UUID]
21+
lock_owner: Optional[str]
22+
23+
24+
def _reactivate_sync_row_update_map(*, now: datetime) -> _SyncRowUpdateMap:
25+
return {
26+
"deleted": False,
27+
"last_processed_at": now,
28+
"lock_expires_at": None,
29+
"lock_token": None,
30+
"lock_owner": None,
31+
}
32+
33+
1434
def run_spec_has_router_replica_group(run_spec: RunSpec) -> bool:
1535
if run_spec.configuration.type != "service":
1636
return False
@@ -36,20 +56,13 @@ async def ensure_service_router_worker_sync_row(
3656
now = common_utils.get_current_datetime()
3757
if sync_row is not None:
3858
if sync_row.deleted:
39-
# If the router replica group is reintroduced (e.g. via re-apply), reactivate the
40-
# existing sync row so the background pipeline resumes syncing router workers.
41-
# Do not import pipeline_tasks.base here: loading that package runs
42-
# pipeline_tasks/__init__.py -> jobs_running -> runs and causes a circular import.
59+
# If the router replica group is reintroduced in service configuration (via re-apply),
60+
# reactivate the existing sync row so the background pipeline resumes syncing router workers.
61+
update_map = _reactivate_sync_row_update_map(now=now)
4362
await session.execute(
4463
update(ServiceRouterWorkerSyncModel)
4564
.where(ServiceRouterWorkerSyncModel.id == sync_row.id)
46-
.values(
47-
deleted=False,
48-
last_processed_at=now,
49-
lock_expires_at=None,
50-
lock_token=None,
51-
lock_owner=None,
52-
)
65+
.values(**update_map)
5366
)
5467
return
5568
session.add(

0 commit comments

Comments
 (0)