Skip to content

Commit 5c928ab

Browse files
authored
Move server deps to dstack[server] extra (#2058)
* Move server deps to dstack[server] extra * Move watchfiles to server deps
1 parent acf60c9 commit 5c928ab

File tree

16 files changed

+42
-66
lines changed

16 files changed

+42
-66
lines changed

setup.py

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,35 +42,36 @@ def get_long_description():
4242
"rich-argparse",
4343
"tqdm",
4444
"simple-term-menu",
45+
"pydantic>=1.10.10,<2.0.0",
46+
"pydantic-duality>=1.2.4",
47+
"websocket-client",
48+
"python-multipart>=0.0.16",
49+
"filelock",
50+
"psutil",
51+
"gpuhunt>=0.0.16,<0.1.0",
52+
]
53+
54+
SERVER_DEPS = [
4555
"fastapi",
4656
"starlette>=0.26.0",
4757
"uvicorn",
48-
"pydantic>=1.10.10,<2.0.0",
49-
"pydantic-duality>=1.2.4",
58+
"watchfiles",
5059
"sqlalchemy[asyncio]>=2.0.0",
5160
"sqlalchemy_utils>=0.40.0",
5261
"alembic>=1.10.2",
5362
"apscheduler<4",
5463
"aiosqlite",
55-
"aiohttp",
56-
"websocket-client",
57-
"watchfiles",
58-
"python-multipart>=0.0.16",
59-
"filelock",
6064
"docker>=6.0.0",
6165
"python-dxf==12.1.0",
62-
"cachetools",
63-
"dnspython",
64-
"grpcio>=1.50", # indirect
65-
"gpuhunt>=0.0.16,<0.1.0",
6666
"sentry-sdk[fastapi]",
67-
"httpx",
68-
"aiorwlock",
69-
"python-json-logger",
7067
"alembic-postgresql-enum",
7168
"asyncpg",
69+
"aiorwlock",
70+
"cachetools",
71+
"httpx",
72+
"python-json-logger",
7273
"jinja2",
73-
"psutil",
74+
"grpcio>=1.50", # indirect
7475
]
7576

7677
AWS_DEPS = [
@@ -105,7 +106,9 @@ def get_long_description():
105106

106107
OCI_DEPS = ["oci"]
107108

108-
ALL_DEPS = AWS_DEPS + AZURE_DEPS + GCP_DEPS + DATACRUNCH_DEPS + KUBERNETES_DEPS + OCI_DEPS
109+
ALL_DEPS = (
110+
SERVER_DEPS + AWS_DEPS + AZURE_DEPS + GCP_DEPS + DATACRUNCH_DEPS + KUBERNETES_DEPS + OCI_DEPS
111+
)
109112

110113
setup(
111114
name="dstack",
@@ -133,13 +136,14 @@ def get_long_description():
133136
install_requires=BASE_DEPS,
134137
extras_require={
135138
"all": ALL_DEPS,
136-
"aws": AWS_DEPS,
137-
"azure": AZURE_DEPS,
138-
"datacrunch": DATACRUNCH_DEPS,
139-
"gcp": GCP_DEPS,
140-
"kubernetes": KUBERNETES_DEPS,
141-
"lambda": LAMBDA_DEPS,
142-
"oci": OCI_DEPS,
139+
"server": SERVER_DEPS,
140+
"aws": SERVER_DEPS + AWS_DEPS,
141+
"azure": SERVER_DEPS + AZURE_DEPS,
142+
"datacrunch": SERVER_DEPS + DATACRUNCH_DEPS,
143+
"gcp": SERVER_DEPS + GCP_DEPS,
144+
"kubernetes": SERVER_DEPS + KUBERNETES_DEPS,
145+
"lambda": SERVER_DEPS + LAMBDA_DEPS,
146+
"oci": SERVER_DEPS + OCI_DEPS,
143147
},
144148
classifiers=[
145149
"Development Status :: 2 - Pre-Alpha",

src/dstack/_internal/cli/commands/server.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import os
22
from argparse import Namespace
33

4-
import uvicorn
5-
64
from dstack import version
75
from dstack._internal.cli.commands import BaseCommand
6+
from dstack._internal.core.errors import CLIError
7+
8+
UVICORN_INSTALLED = True
9+
try:
10+
import uvicorn
11+
except ImportError:
12+
UVICORN_INSTALLED = False
813

914

1015
class ServerCommand(BaseCommand):
@@ -51,6 +56,12 @@ def _register(self):
5156
def _command(self, args: Namespace):
5257
super()._command(args)
5358

59+
if not UVICORN_INSTALLED:
60+
raise CLIError(
61+
"Failed to start dstack server due to missing server dependencies."
62+
"\nInstall server dependencies with `pip install dstack[server]` or `pip install dstack[all]`."
63+
)
64+
5465
os.environ["DSTACK_SERVER_HOST"] = args.host
5566
os.environ["DSTACK_SERVER_PORT"] = str(args.port)
5667
os.environ["DSTACK_SERVER_LOG_LEVEL"] = args.log_level
@@ -62,6 +73,7 @@ def _command(self, args: Namespace):
6273
os.environ["DSTACK_SERVER_ADMIN_TOKEN"] = args.token
6374
uvicorn_log_level = os.getenv("DSTACK_SERVER_UVICORN_LOG_LEVEL", "ERROR").lower()
6475
reload_disabled = os.getenv("DSTACK_SERVER_RELOAD_DISABLED") is not None
76+
6577
uvicorn.run(
6678
"dstack._internal.server.main:app",
6779
host=args.host,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ def run_job(
239239
ssh_keys=[
240240
SSHKey(public=project_ssh_public_key.strip()),
241241
],
242-
job_docker_config=None,
243242
user=run.user,
244243
)
245244
if len(volumes) > 0:

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ def run_job(
197197
ssh_keys=[
198198
SSHKey(public=project_ssh_public_key.strip()),
199199
],
200-
job_docker_config=None,
201200
user=run.user,
202201
)
203202
return self.create_instance(instance_offer, instance_config)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def run_job(
6161
ssh_keys=[
6262
SSHKey(public=project_ssh_public_key.strip()),
6363
],
64-
job_docker_config=None,
6564
user=run.user,
6665
)
6766
return self.create_instance(instance_offer, instance_config)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ def run_job(
156156
ssh_keys=[
157157
SSHKey(public=project_ssh_public_key.strip()),
158158
],
159-
job_docker_config=None,
160159
user=run.user,
161160
)
162161
return self.create_instance(instance_offer, instance_config)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ def run_job(
367367
ssh_keys=[
368368
SSHKey(public=project_ssh_public_key.strip()),
369369
],
370-
job_docker_config=None,
371370
user=run.user,
372371
)
373372
if len(volumes) > 0:

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ def run_job(
113113
),
114114
SSHKey(public=run.run_spec.ssh_key_pub.strip()),
115115
],
116-
job_docker_config=None,
117116
user=run.user,
118117
)
119118
return self.create_instance(instance_offer, instance_config)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ def run_job(
133133
ssh_keys=[
134134
SSHKey(public=project_ssh_public_key.strip()),
135135
],
136-
job_docker_config=None,
137136
user=run.user,
138137
)
139138
return self.create_instance(instance_offer, instance_config)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ def run_job(
9393
project_name=run.project_name,
9494
instance_name=get_instance_name(run, job),
9595
ssh_keys=[SSHKey(public=project_ssh_public_key.strip())],
96-
job_docker_config=None,
9796
user=run.user,
9897
)
9998
return self.create_instance(instance_offer, instance_config)

0 commit comments

Comments
 (0)