Skip to content

Commit

Permalink
fix(BA-660): Model service not destroyed when auto scaling rule is set
Browse files Browse the repository at this point in the history
  • Loading branch information
kyujin-cho committed Feb 14, 2025
1 parent 0e9c95b commit 8a869c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes/.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix model service not removed when auto scaling rules are set
11 changes: 10 additions & 1 deletion src/ai/backend/manager/models/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,10 +640,19 @@ class EndpointAutoScalingRuleRow(Base):
endpoint_row = relationship("EndpointRow", back_populates="endpoint_auto_scaling_rules")

@classmethod
async def list(cls, session: AsyncSession, load_endpoint=False) -> Sequence[Self]:
async def list(
cls,
session: AsyncSession,
load_endpoint=False,
endpoint_status_filter: Container[EndpointLifecycle] = frozenset([
EndpointLifecycle.CREATED
]),
) -> Sequence[Self]:
query = sa.select(EndpointAutoScalingRuleRow)
if load_endpoint:
query = query.options(selectinload(EndpointAutoScalingRuleRow.endpoint_row))
if endpoint_status_filter:
query = query.filter(EndpointRow.lifecycle_stage.in_(endpoint_status_filter))
result = await session.execute(query)
return result.scalars().all()

Expand Down

0 comments on commit 8a869c4

Please sign in to comment.