Skip to content

Commit 2e03cd3

Browse files
authored
Fix replica groups issue 3676 (#3687)
* Complete Fix Replica Groups error * Remove replica-list top-level resources validation; instead add comment --------- Co-authored-by: Bihan Rana
1 parent d01981c commit 2e03cd3

File tree

1 file changed

+2
-11
lines changed
  • src/dstack/_internal/server/services/runs

1 file changed

+2
-11
lines changed

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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
ServiceConfiguration,
66
)
77
from dstack._internal.core.models.repos.virtual import DEFAULT_VIRTUAL_REPO_ID, VirtualRunRepoData
8-
from dstack._internal.core.models.resources import ResourcesSpec
98
from dstack._internal.core.models.runs import LEGACY_REPO_DIR, AnyRunConfiguration, RunSpec
109
from dstack._internal.core.models.volumes import InstanceMountPoint
1110
from dstack._internal.core.services import validate_dstack_resource_name
@@ -113,18 +112,10 @@ def validate_run_spec_and_set_defaults(
113112
raise ServerClientError(
114113
f"Probe timeout cannot be longer than {settings.MAX_PROBE_TIMEOUT}s"
115114
)
116-
if isinstance(run_spec.configuration.replicas, list):
117-
default_resources = ResourcesSpec()
118-
if (
119-
run_spec.configuration.resources
120-
and run_spec.configuration.resources.dict() != default_resources.dict()
121-
):
122-
raise ServerClientError(
123-
"Top-level `resources` is not allowed when `replicas` is a list. "
124-
"Specify `resources` in each replica group instead."
125-
)
126115
if run_spec.configuration.priority is None:
127116
run_spec.configuration.priority = RUN_PRIORITY_DEFAULT
117+
# We do not reject top-level `resources` when `replicas` is a list. Adding strict checks
118+
# would be fragile because the spec may be changed later (for example by plugins).
128119
set_resources_defaults(run_spec.configuration.resources)
129120
set_gpu_vendor_default(
130121
run_spec.configuration.resources,

0 commit comments

Comments
 (0)