From ece70451886a422329601b188b28edec7ca72846 Mon Sep 17 00:00:00 2001 From: Gyubong Date: Thu, 7 Nov 2024 14:19:52 +0900 Subject: [PATCH 01/13] fix: Broken ComputeContainer GQL --- src/ai/backend/manager/models/kernel.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ai/backend/manager/models/kernel.py b/src/ai/backend/manager/models/kernel.py index 33924e60a5..91d8588017 100644 --- a/src/ai/backend/manager/models/kernel.py +++ b/src/ai/backend/manager/models/kernel.py @@ -1113,9 +1113,7 @@ async def batch_load_detail( .where( (KernelRow.id.in_(container_ids)), ) - .options(selectinload(KernelRow.group_row)) - .options(selectinload(KernelRow.user_row)) - .options(selectinload(KernelRow.image_row)) + .options(noload("*")) ) if domain_name is not None: query = query.where(KernelRow.domain_name == domain_name) From 232fb8bafcf1fc10270da479485f40eecaf23413 Mon Sep 17 00:00:00 2001 From: Gyubong Date: Thu, 7 Nov 2024 14:25:43 +0900 Subject: [PATCH 02/13] chore: Add news fragment --- changes/3042.fix.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/3042.fix.md diff --git a/changes/3042.fix.md b/changes/3042.fix.md new file mode 100644 index 0000000000..862e6e4bc0 --- /dev/null +++ b/changes/3042.fix.md @@ -0,0 +1 @@ +Fix broken `ComputeContainer` GQL. From c7c77079cc88c78811c3b98d79f2d740725c9e62 Mon Sep 17 00:00:00 2001 From: Gyubong Date: Thu, 7 Nov 2024 14:43:17 +0900 Subject: [PATCH 03/13] fix: `image_object` not loading --- src/ai/backend/manager/models/kernel.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ai/backend/manager/models/kernel.py b/src/ai/backend/manager/models/kernel.py index 91d8588017..6a8cfe259a 100644 --- a/src/ai/backend/manager/models/kernel.py +++ b/src/ai/backend/manager/models/kernel.py @@ -1113,6 +1113,7 @@ async def batch_load_detail( .where( (KernelRow.id.in_(container_ids)), ) + .options(selectinload(KernelRow.image_row)) .options(noload("*")) ) if domain_name is not None: From e4b74ee5cf2d91486995a43379ab951079768f18 Mon Sep 17 00:00:00 2001 From: Gyubong Lee Date: Thu, 7 Nov 2024 05:44:03 +0000 Subject: [PATCH 04/13] docs: Rename the news fragment with the PR number .fix.md -> 3042.fix.md --- changes/3042.fix.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/3042.fix.md b/changes/3042.fix.md index 862e6e4bc0..51d9fb7a5e 100644 --- a/changes/3042.fix.md +++ b/changes/3042.fix.md @@ -1 +1 @@ -Fix broken `ComputeContainer` GQL. +Fix model service traffics not distributed equally to every sessions when there are 10 or more replicas From 25f3af9931798e5d5a66128c950eeb93110025c8 Mon Sep 17 00:00:00 2001 From: Gyubong Date: Thu, 7 Nov 2024 14:52:08 +0900 Subject: [PATCH 05/13] Revert "docs: Rename the news fragment with the PR number" This reverts commit e4b74ee5cf2d91486995a43379ab951079768f18. --- changes/3042.fix.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/3042.fix.md b/changes/3042.fix.md index 51d9fb7a5e..862e6e4bc0 100644 --- a/changes/3042.fix.md +++ b/changes/3042.fix.md @@ -1 +1 @@ -Fix model service traffics not distributed equally to every sessions when there are 10 or more replicas +Fix broken `ComputeContainer` GQL. From c409b213c4f4a595da3112d2757c47295816a9b9 Mon Sep 17 00:00:00 2001 From: Gyubong Lee Date: Thu, 7 Nov 2024 05:52:54 +0000 Subject: [PATCH 06/13] docs: Rename the news fragment with the PR number .fix.md -> 3042.fix.md --- changes/3042.fix.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/3042.fix.md b/changes/3042.fix.md index 862e6e4bc0..51d9fb7a5e 100644 --- a/changes/3042.fix.md +++ b/changes/3042.fix.md @@ -1 +1 @@ -Fix broken `ComputeContainer` GQL. +Fix model service traffics not distributed equally to every sessions when there are 10 or more replicas From 6db10f489ad1667773e1bf8e72ab78c4af05aa12 Mon Sep 17 00:00:00 2001 From: Gyubong Date: Thu, 7 Nov 2024 15:03:08 +0900 Subject: [PATCH 07/13] chore: Rename news fragment --- changes/3042.fix.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/3042.fix.md b/changes/3042.fix.md index 51d9fb7a5e..862e6e4bc0 100644 --- a/changes/3042.fix.md +++ b/changes/3042.fix.md @@ -1 +1 @@ -Fix model service traffics not distributed equally to every sessions when there are 10 or more replicas +Fix broken `ComputeContainer` GQL. From 0e27721985b085d740acfdfb7cfb1a52fcc46488 Mon Sep 17 00:00:00 2001 From: Gyubong Lee Date: Thu, 7 Nov 2024 06:03:51 +0000 Subject: [PATCH 08/13] docs: Rename the news fragment with the PR number .fix.md -> 3042.fix.md --- changes/3042.fix.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/3042.fix.md b/changes/3042.fix.md index 862e6e4bc0..51d9fb7a5e 100644 --- a/changes/3042.fix.md +++ b/changes/3042.fix.md @@ -1 +1 @@ -Fix broken `ComputeContainer` GQL. +Fix model service traffics not distributed equally to every sessions when there are 10 or more replicas From 6eed713fc6d4e32960545cf15c7be0368b34dbf1 Mon Sep 17 00:00:00 2001 From: Gyubong Date: Thu, 7 Nov 2024 15:16:10 +0900 Subject: [PATCH 09/13] fix: Revert `selectinload` again --- src/ai/backend/manager/models/kernel.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ai/backend/manager/models/kernel.py b/src/ai/backend/manager/models/kernel.py index 6a8cfe259a..7fa9c79317 100644 --- a/src/ai/backend/manager/models/kernel.py +++ b/src/ai/backend/manager/models/kernel.py @@ -1113,6 +1113,8 @@ async def batch_load_detail( .where( (KernelRow.id.in_(container_ids)), ) + .options(selectinload(KernelRow.group_row)) + .options(selectinload(KernelRow.user_row)) .options(selectinload(KernelRow.image_row)) .options(noload("*")) ) From 4f820dc1ee1886f36a6b28a6ebcc4cad2bc94a8c Mon Sep 17 00:00:00 2001 From: Gyubong Date: Sat, 9 Nov 2024 13:01:16 +0900 Subject: [PATCH 10/13] Revert "docs: Rename the news fragment with the PR number" This reverts commit 0e27721985b085d740acfdfb7cfb1a52fcc46488. --- changes/3042.fix.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/3042.fix.md b/changes/3042.fix.md index 51d9fb7a5e..862e6e4bc0 100644 --- a/changes/3042.fix.md +++ b/changes/3042.fix.md @@ -1 +1 @@ -Fix model service traffics not distributed equally to every sessions when there are 10 or more replicas +Fix broken `ComputeContainer` GQL. From 8bc63c7b600ca50ea4645f18d529cd25cfa80b86 Mon Sep 17 00:00:00 2001 From: Joongi Kim Date: Tue, 12 Nov 2024 07:48:09 +0900 Subject: [PATCH 11/13] refactor: Make it less redundant and reorder to exhibit priority of load options --- src/ai/backend/manager/models/kernel.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/ai/backend/manager/models/kernel.py b/src/ai/backend/manager/models/kernel.py index 7fa9c79317..ee279cd92e 100644 --- a/src/ai/backend/manager/models/kernel.py +++ b/src/ai/backend/manager/models/kernel.py @@ -605,8 +605,8 @@ async def _query(): sa.select(KernelRow) .where(KernelRow.id == kern_id) .options( - noload("*"), selectinload(KernelRow.agent_row).options(noload("*")), + noload("*"), ) ) result = (await db_sess.execute(query)).scalars().all() @@ -745,8 +745,8 @@ async def _update() -> bool: .where(KernelRow.id == kernel_id) .with_for_update() .options( - noload("*"), load_only(KernelRow.status, KernelRow.session_id), + noload("*"), ) ) kernel_row = (await db_session.scalars(kernel_query)).first() @@ -1113,10 +1113,14 @@ async def batch_load_detail( .where( (KernelRow.id.in_(container_ids)), ) - .options(selectinload(KernelRow.group_row)) - .options(selectinload(KernelRow.user_row)) - .options(selectinload(KernelRow.image_row)) - .options(noload("*")) + .options( + noload("*"), + selectinload( + KernelRow.group_row, + KernelRow.user_row, + KernelRow.image_row, + ), + ) ) if domain_name is not None: query = query.where(KernelRow.domain_name == domain_name) From 36bcff2620a61684832e2766c76e6240285ff6be Mon Sep 17 00:00:00 2001 From: Joongi Kim Date: Tue, 12 Nov 2024 07:49:41 +0900 Subject: [PATCH 12/13] fix: unintended reorder;; --- src/ai/backend/manager/models/kernel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ai/backend/manager/models/kernel.py b/src/ai/backend/manager/models/kernel.py index ee279cd92e..3738ccab74 100644 --- a/src/ai/backend/manager/models/kernel.py +++ b/src/ai/backend/manager/models/kernel.py @@ -605,8 +605,8 @@ async def _query(): sa.select(KernelRow) .where(KernelRow.id == kern_id) .options( - selectinload(KernelRow.agent_row).options(noload("*")), noload("*"), + selectinload(KernelRow.agent_row).options(noload("*")), ) ) result = (await db_sess.execute(query)).scalars().all() @@ -745,8 +745,8 @@ async def _update() -> bool: .where(KernelRow.id == kernel_id) .with_for_update() .options( - load_only(KernelRow.status, KernelRow.session_id), noload("*"), + load_only(KernelRow.status, KernelRow.session_id), ) ) kernel_row = (await db_session.scalars(kernel_query)).first() From 1ed0086a4a20ac1df021a7a9203fec81a3fed11a Mon Sep 17 00:00:00 2001 From: Joongi Kim Date: Tue, 12 Nov 2024 09:05:19 +0900 Subject: [PATCH 13/13] doc: Refine news fragment --- changes/3042.fix.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/3042.fix.md b/changes/3042.fix.md index 862e6e4bc0..9a28b7ce51 100644 --- a/changes/3042.fix.md +++ b/changes/3042.fix.md @@ -1 +1 @@ -Fix broken `ComputeContainer` GQL. +Fix regression of `ComputeContainer` GraphQL queries due to newly introduced relationship fields