|
31 | 31 | from dstack._internal.core.models.services import AnyModel, OpenAIChatModel |
32 | 32 | from dstack._internal.core.models.unix import UnixUser |
33 | 33 | from dstack._internal.core.models.volumes import MountPoint, VolumeConfiguration, parse_mount_point |
34 | | -from dstack._internal.core.services import is_valid_dstack_resource_name |
| 34 | +from dstack._internal.core.services import is_valid_replica_group_name |
35 | 35 | from dstack._internal.utils.common import has_duplicates, list_enum_values_for_annotation |
36 | 36 | from dstack._internal.utils.json_schema import add_extra_schema_types |
37 | 37 | from dstack._internal.utils.json_utils import ( |
|
55 | 55 | DEFAULT_PROBE_READY_AFTER = 1 |
56 | 56 | DEFAULT_PROBE_METHOD = "get" |
57 | 57 | MAX_PROBE_URL_LEN = 2048 |
58 | | -DEFAULT_REPLICA_GROUP_NAME = "default" |
| 58 | +DEFAULT_REPLICA_GROUP_NAME = "0" |
59 | 59 |
|
60 | 60 |
|
61 | 61 | class RunConfigurationType(str, Enum): |
@@ -756,7 +756,7 @@ class ReplicaGroup(CoreModel): |
756 | 756 | name: Annotated[ |
757 | 757 | Optional[str], |
758 | 758 | Field( |
759 | | - description="The name of the replica group. If not provided, defaults to 'replica-group-0', 'replica-group-1', etc. based on position." |
| 759 | + description="The name of the replica group. If not provided, defaults to '0', '1', etc. based on position." |
760 | 760 | ), |
761 | 761 | ] |
762 | 762 | count: Annotated[ |
@@ -784,8 +784,8 @@ class ReplicaGroup(CoreModel): |
784 | 784 | @validator("name") |
785 | 785 | def validate_name(cls, v: Optional[str]) -> Optional[str]: |
786 | 786 | if v is not None: |
787 | | - if not is_valid_dstack_resource_name(v): |
788 | | - raise ValueError("Resource name should match regex '^[a-z][a-z0-9-]{1,40}$'") |
| 787 | + if not is_valid_replica_group_name(v): |
| 788 | + raise ValueError("Resource name should match regex '^[a-z0-9][a-z0-9-]{0,39}$'") |
789 | 789 | return v |
790 | 790 |
|
791 | 791 | @validator("count") |
@@ -920,7 +920,7 @@ def validate_replicas( |
920 | 920 | # Assign default names to groups without names |
921 | 921 | for index, group in enumerate(v): |
922 | 922 | if group.name is None: |
923 | | - group.name = f"replica-group-{index}" |
| 923 | + group.name = str(index) |
924 | 924 |
|
925 | 925 | # Check for duplicate names |
926 | 926 | names = [group.name for group in v] |
|
0 commit comments