From 4335e38d3f2f5df7daddb2a59fa695c76fb01064 Mon Sep 17 00:00:00 2001 From: Jvst Me Date: Thu, 26 Dec 2024 11:27:08 +0100 Subject: [PATCH] Optimize `dstack-gateway` installation time Add the `dstack[gateway]` extra, so that the gateway doesn't install `dstack[server]`. `dstack[gateway]` still has some unnecessary dependencies from BASE_DEPS, but the current optimization is enough for now. Also increase the gateway installation timeout just in case. --- gateway/pyproject.toml | 2 +- setup.py | 14 +++++++++----- .../_internal/server/services/gateways/__init__.py | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/gateway/pyproject.toml b/gateway/pyproject.toml index 6b3853838..bf7761f15 100644 --- a/gateway/pyproject.toml +++ b/gateway/pyproject.toml @@ -11,7 +11,7 @@ requires-python = ">=3.10" dynamic = ["version"] dependencies = [ # release builds of dstack-gateway depend on a PyPI version of dstack instead - "dstack[server] @ https://github.com/dstackai/dstack/archive/refs/heads/master.zip", + "dstack[gateway] @ https://github.com/dstackai/dstack/archive/refs/heads/master.zip", ] [tool.setuptools.package-data] diff --git a/setup.py b/setup.py index 35cd3f44a..7b2662a2b 100644 --- a/setup.py +++ b/setup.py @@ -51,10 +51,17 @@ def get_long_description(): "gpuhunt>=0.0.17,<0.1.0", ] -SERVER_DEPS = [ +GATEWAY_AND_SERVER_COMMON_DEPS = [ "fastapi", "starlette>=0.26.0", "uvicorn", + "aiorwlock", + "aiocache", + "httpx", + "jinja2", +] + +SERVER_DEPS = GATEWAY_AND_SERVER_COMMON_DEPS + [ "watchfiles", "sqlalchemy[asyncio]>=2.0.0", "sqlalchemy_utils>=0.40.0", @@ -66,12 +73,8 @@ def get_long_description(): "sentry-sdk[fastapi]", "alembic-postgresql-enum", "asyncpg", - "aiorwlock", - "aiocache", "cachetools", - "httpx", "python-json-logger", - "jinja2", "grpcio>=1.50", # indirect ] @@ -138,6 +141,7 @@ def get_long_description(): install_requires=BASE_DEPS, extras_require={ "all": ALL_DEPS, + "gateway": GATEWAY_AND_SERVER_COMMON_DEPS, "server": SERVER_DEPS, "aws": SERVER_DEPS + AWS_DEPS, "azure": SERVER_DEPS + AZURE_DEPS, diff --git a/src/dstack/_internal/server/services/gateways/__init__.py b/src/dstack/_internal/server/services/gateways/__init__.py index dd476fce0..de385162c 100644 --- a/src/dstack/_internal/server/services/gateways/__init__.py +++ b/src/dstack/_internal/server/services/gateways/__init__.py @@ -78,7 +78,7 @@ GATEWAY_CONNECT_ATTEMPTS = 30 GATEWAY_CONNECT_DELAY = 10 -GATEWAY_CONFIGURE_ATTEMPTS = 40 +GATEWAY_CONFIGURE_ATTEMPTS = 50 GATEWAY_CONFIGURE_DELAY = 3