Skip to content

Commit

Permalink
Merge branch 'main' into feature/improve-vf-purge-using-bgtask
Browse files Browse the repository at this point in the history
  • Loading branch information
fregataa committed Mar 6, 2024
2 parents 86f6494 + bc7bafb commit 5dde934
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 28 deletions.
1 change: 1 addition & 0 deletions changes/1950.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use `buildDate` instead of `build` to retrieve web static version to follow lablup/backend.ai-webui#2072
1 change: 1 addition & 0 deletions changes/1952.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix `endpoint.routings` GQL field showing routing ID instead of status enum
2 changes: 1 addition & 1 deletion scripts/install-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ configure_backendai() {
install_editable_webui
sed_inplace "s@\(#\)\{0,1\}static_path = .*@static_path = "'"src/ai/backend/webui/build/rollup"'"@" ./webserver.conf
else
webui_version=$(jq -r '.package + " (built at " + .build + ", rev " + .revision + ")"' src/ai/backend/web/static/version.json)
webui_version=$(jq -r '.package + " (built at " + .buildDate + ", rev " + .revision + ")"' src/ai/backend/web/static/version.json)
show_note "The currently embedded webui version: $webui_version"
fi

Expand Down
38 changes: 13 additions & 25 deletions src/ai/backend/manager/models/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,18 +508,7 @@ async def from_row(
created_at=row.created_at,
destroyed_at=row.destroyed_at,
retries=row.retries,
routings=[
Routing(
routing_id=r.id,
endpoint=row.url,
session=r.session,
status=r.session,
traffic_ratio=r.traffic_ratio,
created_at=r.created_at,
error_data=r.error_data,
)
for r in row.routings
],
routings=[await Routing.from_row(None, r, endpoint=row) for r in row.routings],
lifecycle_stage=row.lifecycle_stage.name,
)

Expand Down Expand Up @@ -653,15 +642,21 @@ async def load_item(
async def resolve_status(self, info: graphene.ResolveInfo) -> str:
if self.retries > SERVICE_MAX_RETRIES:
return "UNHEALTHY"
if self.lifecycle_stage == EndpointLifecycle.DESTROYING.name:
if self.lifecycle_stage == EndpointLifecycle.DESTROYING:
return "DESTROYING"
if len(self.routings) == 0:
return "READY"
if (
len([r for r in self.routings if r.status == RouteStatus.HEALTHY.name])
== self.desired_session_count
):
return "HEALTHY"
if (spawned_service_count := len([r for r in self.routings])) > 0:
healthy_service_count = len([
r for r in self.routings if r.status == RouteStatus.HEALTHY.name
])
if healthy_service_count == spawned_service_count:
return "HEALTHY"
unhealthy_service_count = len([
r for r in self.routings if r.status == RouteStatus.UNHEALTHY.name
])
if unhealthy_service_count > 0:
return "DEGRADED"
return "PROVISIONING"

async def resolve_errors(self, info: graphene.ResolveInfo) -> Any:
Expand Down Expand Up @@ -873,13 +868,6 @@ async def load_slice(
domain_name: Optional[str] = None,
user_uuid: Optional[uuid.UUID] = None,
) -> Sequence["EndpointToken"]:
log.debug(
"Endpoint: {}, project: {}, domain: {}, user: {}",
endpoint_id,
project,
domain_name,
user_uuid,
)
query = (
sa.select(EndpointTokenRow)
.limit(limit)
Expand Down
5 changes: 3 additions & 2 deletions src/ai/backend/manager/models/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

if TYPE_CHECKING:
# from .gql import GraphQueryContext
pass
from .endpoint import EndpointRow


__all__ = ("RoutingRow", "Routing", "RoutingList", "RouteStatus")
Expand Down Expand Up @@ -217,10 +217,11 @@ async def from_row(
cls,
ctx, # ctx: GraphQueryContext,
row: RoutingRow,
endpoint: Optional["EndpointRow"] = None,
) -> "Routing":
return cls(
routing_id=row.id,
endpoint=row.endpoint_row.url,
endpoint=(endpoint or row.endpoint_row).url,
session=row.session,
status=row.status.name,
traffic_ratio=row.traffic_ratio,
Expand Down

0 comments on commit 5dde934

Please sign in to comment.