From 369490cae17db921c1d79c3d43941d6fbf46fb73 Mon Sep 17 00:00:00 2001 From: Jeongseok Kang Date: Tue, 5 Mar 2024 15:21:12 +0900 Subject: [PATCH 1/3] fix: Use `buildDate` to access web static build version (#1950) --- changes/1950.fix.md | 1 + scripts/install-dev.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changes/1950.fix.md diff --git a/changes/1950.fix.md b/changes/1950.fix.md new file mode 100644 index 0000000000..6cd6f54caa --- /dev/null +++ b/changes/1950.fix.md @@ -0,0 +1 @@ +Use `buildDate` instead of `build` to retrieve web static version to follow lablup/backend.ai-webui#2072 diff --git a/scripts/install-dev.sh b/scripts/install-dev.sh index f8e3f5237a..dadf935279 100755 --- a/scripts/install-dev.sh +++ b/scripts/install-dev.sh @@ -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 From 85581c3a4186410f2595f09419763b70d7011ab9 Mon Sep 17 00:00:00 2001 From: Kyujin Cho Date: Tue, 5 Mar 2024 20:56:33 +0800 Subject: [PATCH 2/3] fix: model service route status incorrectly displayed (#1952) --- changes/1952.fix.md | 1 + src/ai/backend/manager/models/endpoint.py | 38 ++++++++--------------- 2 files changed, 14 insertions(+), 25 deletions(-) create mode 100644 changes/1952.fix.md diff --git a/changes/1952.fix.md b/changes/1952.fix.md new file mode 100644 index 0000000000..a36f2ddf4f --- /dev/null +++ b/changes/1952.fix.md @@ -0,0 +1 @@ +Fix `endpoint.routings` GQL field showing routing ID instead of status enum diff --git a/src/ai/backend/manager/models/endpoint.py b/src/ai/backend/manager/models/endpoint.py index bab984e8d3..380a5a4e3a 100644 --- a/src/ai/backend/manager/models/endpoint.py +++ b/src/ai/backend/manager/models/endpoint.py @@ -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) for r in row.routings], lifecycle_stage=row.lifecycle_stage.name, ) @@ -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: @@ -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) From bc7bafb916464c96b3d17647759e2e64ac8f9448 Mon Sep 17 00:00:00 2001 From: Kyujin Cho Date: Wed, 6 Mar 2024 00:27:44 +0800 Subject: [PATCH 3/3] hotfix: `endpoint` GQL query not working * fix regression raised after #1952 is merged --- src/ai/backend/manager/models/endpoint.py | 2 +- src/ai/backend/manager/models/routing.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ai/backend/manager/models/endpoint.py b/src/ai/backend/manager/models/endpoint.py index 380a5a4e3a..ec24026b95 100644 --- a/src/ai/backend/manager/models/endpoint.py +++ b/src/ai/backend/manager/models/endpoint.py @@ -508,7 +508,7 @@ async def from_row( created_at=row.created_at, destroyed_at=row.destroyed_at, retries=row.retries, - routings=[await Routing.from_row(None, r) 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, ) diff --git a/src/ai/backend/manager/models/routing.py b/src/ai/backend/manager/models/routing.py index c8bfaba29b..f51355a086 100644 --- a/src/ai/backend/manager/models/routing.py +++ b/src/ai/backend/manager/models/routing.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # from .gql import GraphQueryContext - pass + from .endpoint import EndpointRow __all__ = ("RoutingRow", "Routing", "RoutingList", "RouteStatus") @@ -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,