From 3d9a886d7352b80afd9bfb03f11706bf7c62c455 Mon Sep 17 00:00:00 2001 From: Sujin Kim Date: Mon, 23 Oct 2023 16:57:00 +0900 Subject: [PATCH] fix: change `max_vfolder_count` type from BigInt to Int (#1643) Backported-from: main Backported-to: 23.09 --- changes/1643.fix.md | 1 + src/ai/backend/manager/models/resource_policy.py | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 changes/1643.fix.md diff --git a/changes/1643.fix.md b/changes/1643.fix.md new file mode 100644 index 0000000000..a0fb984cbd --- /dev/null +++ b/changes/1643.fix.md @@ -0,0 +1 @@ +To resolve the type mismatch between DB and schema, changed all schema types of `max_vfolder_count` to int. diff --git a/src/ai/backend/manager/models/resource_policy.py b/src/ai/backend/manager/models/resource_policy.py index ef54390211..581aec2875 100644 --- a/src/ai/backend/manager/models/resource_policy.py +++ b/src/ai/backend/manager/models/resource_policy.py @@ -418,6 +418,7 @@ class UserResourcePolicy(graphene.ObjectType): name = graphene.String(required=True) created_at = GQLDateTime(required=True) max_vfolder_size = BigInt(deprecation_reason="Deprecated since 23.09.1") + max_vfolder_count = graphene.Int() max_quota_scope_size = BigInt() @classmethod @@ -490,11 +491,13 @@ async def batch_load_by_user( class CreateUserResourcePolicyInput(graphene.InputObjectType): - max_quota_scope_size = BigInt() + max_vfolder_count = graphene.Int(required=True) + max_quota_scope_size = BigInt(required=True) class ModifyUserResourcePolicyInput(graphene.InputObjectType): - max_quota_scope_size = BigInt() + max_vfolder_count = graphene.Int(required=True) + max_quota_scope_size = BigInt(required=True) class CreateUserResourcePolicy(graphene.Mutation): @@ -588,7 +591,8 @@ class ProjectResourcePolicy(graphene.ObjectType): id = graphene.ID(required=True) name = graphene.String(required=True) created_at = GQLDateTime(required=True) - max_vfolder_size = BigInt(deprecation_reason="Deprecated since 23.09.1") + max_vfolder_count = graphene.Int() + max_vfolder_size = BigInt() # aliased field max_quota_scope_size = BigInt() @classmethod @@ -661,11 +665,13 @@ async def batch_load_by_project( class CreateProjectResourcePolicyInput(graphene.InputObjectType): - max_quota_scope_size = BigInt() + max_vfolder_count = graphene.Int(required=True) + max_quota_scope_size = BigInt(required=True) class ModifyProjectResourcePolicyInput(graphene.InputObjectType): - max_quota_scope_size = BigInt() + max_vfolder_count = graphene.Int(required=True) + max_quota_scope_size = BigInt(required=True) class CreateProjectResourcePolicy(graphene.Mutation):