Skip to content

Commit f302803

Browse files
jopemachineclaude
andcommitted
refactor(BA-5982): rename ReplicaCountData → ReplicaData
Per review feedback. The wrapper used to pair the persisted ``replica_count`` with the optional ``desired_replica_count`` no longer needs the ``Count`` qualifier now that the owning field on ``DeploymentInfo`` is just ``replica`` — calling the type ``ReplicaData`` matches the field name and is consistent with the rest of the ``…Data`` family in this module. No behavior change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2683af0 commit f302803

9 files changed

Lines changed: 22 additions & 22 deletions

File tree

src/ai/backend/manager/data/deployment/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def target_replica_count(self) -> int:
359359

360360

361361
@dataclass
362-
class ReplicaCountData:
362+
class ReplicaData:
363363
replica_count: int
364364
desired_replica_count: int | None
365365

@@ -684,7 +684,7 @@ class DeploymentInfo:
684684
id: DeploymentID
685685
metadata: DeploymentMetadata
686686
state: DeploymentState
687-
replica: ReplicaCountData
687+
replica: ReplicaData
688688
network: DeploymentNetworkData
689689
model_revisions: list[ModelRevisionData]
690690
options: DeploymentOptions

src/ai/backend/manager/models/endpoint/row.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
DeploymentSummaryData,
7474
ModelDeploymentAutoScalingRuleData,
7575
ModelRevisionData,
76-
ReplicaCountData,
76+
ReplicaData,
7777
)
7878
from ai.backend.manager.data.model_serving.types import (
7979
EndpointAutoScalingRuleData,
@@ -765,7 +765,7 @@ def _to_deployment_info_with_revisions(
765765
scaling_state=self.scaling_state,
766766
retry_count=self.retries,
767767
),
768-
replica=ReplicaCountData(
768+
replica=ReplicaData(
769769
replica_count=self.replicas,
770770
desired_replica_count=self.desired_replicas,
771771
),

tests/unit/manager/services/deployment/test_deployment_crud_actions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
ModelMountConfigData,
4444
ModelRevisionData,
4545
ModelRuntimeConfigData,
46-
ReplicaCountData,
46+
ReplicaData,
4747
ResourceConfigData,
4848
RouteHealthStatus,
4949
RouteInfo,
@@ -148,7 +148,7 @@ def endpoint_info(self, endpoint_id: uuid.UUID) -> DeploymentInfo:
148148
scaling_state=ScalingState.STABLE,
149149
retry_count=0,
150150
),
151-
replica=ReplicaCountData(replica_count=2, desired_replica_count=None),
151+
replica=ReplicaData(replica_count=2, desired_replica_count=None),
152152
network=DeploymentNetworkData(
153153
open_to_public=False, access_token_ids=None, url=None, preferred_domain_name=None
154154
),

tests/unit/manager/services/deployment/test_deployment_service.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
ModelMountConfigData,
5454
ModelRevisionData,
5555
ModelRuntimeConfigData,
56-
ReplicaCountData,
56+
ReplicaData,
5757
ResourceConfigData,
5858
ResourceSpec,
5959
)
@@ -378,7 +378,7 @@ def deployment_info(self, deployment_id: uuid.UUID) -> DeploymentInfo:
378378
scaling_state=ScalingState.STABLE,
379379
retry_count=0,
380380
),
381-
replica=ReplicaCountData(replica_count=1, desired_replica_count=None),
381+
replica=ReplicaData(replica_count=1, desired_replica_count=None),
382382
network=DeploymentNetworkData(
383383
open_to_public=False, access_token_ids=None, url=None, preferred_domain_name=None
384384
),
@@ -550,7 +550,7 @@ def deployment_info(
550550
scaling_state=ScalingState.STABLE,
551551
retry_count=0,
552552
),
553-
replica=ReplicaCountData(replica_count=1, desired_replica_count=None),
553+
replica=ReplicaData(replica_count=1, desired_replica_count=None),
554554
network=DeploymentNetworkData(
555555
open_to_public=False, access_token_ids=None, url=None, preferred_domain_name=None
556556
),
@@ -714,7 +714,7 @@ def test_current_revision_resolved_by_id_match_not_list_order(
714714
scaling_state=ScalingState.STABLE,
715715
retry_count=0,
716716
),
717-
replica=ReplicaCountData(replica_count=1, desired_replica_count=None),
717+
replica=ReplicaData(replica_count=1, desired_replica_count=None),
718718
network=DeploymentNetworkData(
719719
open_to_public=False, access_token_ids=None, url=None, preferred_domain_name=None
720720
),

tests/unit/manager/sokovan/deployment/executor/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
DeploymentOptions,
2222
DeploymentState,
2323
ModelRevisionData,
24-
ReplicaCountData,
24+
ReplicaData,
2525
RouteHealthStatus,
2626
RouteStatus,
2727
)
@@ -153,7 +153,7 @@ def _create_deployment_info(
153153
scaling_state=ScalingState.STABLE,
154154
retry_count=0,
155155
),
156-
replica=ReplicaCountData(
156+
replica=ReplicaData(
157157
replica_count=replica_count,
158158
desired_replica_count=desired_replica_count,
159159
),

tests/unit/manager/sokovan/deployment/handlers/test_deploying_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
DeploymentNetworkData,
2727
DeploymentOptions,
2828
DeploymentState,
29-
ReplicaCountData,
29+
ReplicaData,
3030
)
3131
from ai.backend.manager.data.resource.types import ScalingGroupProxyTarget
3232
from ai.backend.manager.sokovan.deployment.handlers.deploying import (
@@ -123,7 +123,7 @@ def deployment_created_without_revision(self) -> DeploymentWithHistory:
123123
scaling_state=ScalingState.STABLE,
124124
retry_count=0,
125125
),
126-
replica=ReplicaCountData(
126+
replica=ReplicaData(
127127
replica_count=1,
128128
desired_replica_count=1,
129129
),

tests/unit/manager/sokovan/deployment/route/executor/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
DeploymentNetworkData,
2020
DeploymentOptions,
2121
DeploymentState,
22-
ReplicaCountData,
22+
ReplicaData,
2323
RouteHealthStatus,
2424
RouteStatus,
2525
)
@@ -161,7 +161,7 @@ def _create_deployment_info(
161161
scaling_state=ScalingState.STABLE,
162162
retry_count=0,
163163
),
164-
replica=ReplicaCountData(
164+
replica=ReplicaData(
165165
replica_count=1,
166166
desired_replica_count=1,
167167
),

tests/unit/manager/sokovan/deployment/strategy/test_rolling_update.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
DeploymentNetworkData,
3333
DeploymentOptions,
3434
DeploymentState,
35-
ReplicaCountData,
35+
ReplicaData,
3636
RouteHealthStatus,
3737
RouteInfo,
3838
RouteStatus,
@@ -117,7 +117,7 @@ def make_deployment(
117117
scaling_state=ScalingState.STABLE,
118118
retry_count=0,
119119
),
120-
replica=ReplicaCountData(
120+
replica=ReplicaData(
121121
replica_count=desired,
122122
desired_replica_count=None,
123123
),
@@ -927,7 +927,7 @@ class TestDesiredReplicaCount:
927927
def test_desired_replica_count_overrides_replica_count(self) -> None:
928928
"""When desired_replica_count is set, it takes precedence."""
929929
deployment = make_deployment(desired=3)
930-
deployment.replica = ReplicaCountData(
930+
deployment.replica = ReplicaData(
931931
replica_count=1,
932932
desired_replica_count=3,
933933
)
@@ -943,7 +943,7 @@ def test_desired_replica_count_overrides_replica_count(self) -> None:
943943
def test_replica_count_used_when_no_desired(self) -> None:
944944
"""When desired_replica_count is None, uses replica_count."""
945945
deployment = make_deployment(desired=2)
946-
deployment.replica = ReplicaCountData(
946+
deployment.replica = ReplicaData(
947947
replica_count=2,
948948
desired_replica_count=None,
949949
)

tests/unit/manager/sokovan/deployment/test_coordinator_history.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
DeploymentState,
2121
DeploymentStatusTransitions,
2222
DeploymentTargetStatuses,
23-
ReplicaCountData,
23+
ReplicaData,
2424
)
2525
from ai.backend.manager.repositories.deployment import DeploymentRepository
2626
from ai.backend.manager.sokovan.deployment.coordinator import DeploymentCoordinator
@@ -61,7 +61,7 @@ def sample_deployment_info() -> DeploymentInfo:
6161
scaling_state=ScalingState.STABLE,
6262
retry_count=0,
6363
),
64-
replica=ReplicaCountData(
64+
replica=ReplicaData(
6565
replica_count=1,
6666
desired_replica_count=None,
6767
),

0 commit comments

Comments
 (0)