diff --git a/changes/1644.fix.md b/changes/1644.fix.md new file mode 100644 index 0000000000..6ce10c7408 --- /dev/null +++ b/changes/1644.fix.md @@ -0,0 +1 @@ +Set deprecation message to `max_vfolder_size` graphene field. Set `max_vfolder_count` and `max_quota_scope_size` graphene fields optional. Update VFolder update API to use renewed column name `max_quota_scope_size`. diff --git a/src/ai/backend/manager/api/vfolder.py b/src/ai/backend/manager/api/vfolder.py index 1737de20ef..961b16fe22 100644 --- a/src/ai/backend/manager/api/vfolder.py +++ b/src/ai/backend/manager/api/vfolder.py @@ -1058,10 +1058,10 @@ async def update_quota(request: web.Request, params: Any) -> web.Response: if len(entries) == 0: raise VFolderNotFound(extra_data=params["id"]) - # Limit vfolder size quota if it is larger than max_vfolder_size of the resource policy. - max_vfolder_size = resource_policy.get("max_vfolder_size", 0) - if max_vfolder_size > 0 and (quota <= 0 or quota > max_vfolder_size): - quota = max_vfolder_size + # Limit vfolder size quota if it is larger than max_quota_scope_size of the resource policy. + max_quota_scope_size = resource_policy.get("max_quota_scope_size", 0) + if max_quota_scope_size > 0 and (quota <= 0 or quota > max_quota_scope_size): + quota = max_quota_scope_size async with root_ctx.storage_manager.request( proxy_name, diff --git a/src/ai/backend/manager/models/resource_policy.py b/src/ai/backend/manager/models/resource_policy.py index 72da358c14..b6eb65b28a 100644 --- a/src/ai/backend/manager/models/resource_policy.py +++ b/src/ai/backend/manager/models/resource_policy.py @@ -417,7 +417,9 @@ class UserResourcePolicy(graphene.ObjectType): id = graphene.ID(required=True) name = graphene.String(required=True) created_at = GQLDateTime(required=True) - max_vfolder_size = BigInt() + max_vfolder_count = graphene.Int() + max_vfolder_size = BigInt(deprecation_reason="Deprecated since 23.09.1") + max_quota_scope_size = BigInt() @classmethod def from_row( @@ -488,11 +490,13 @@ async def batch_load_by_user( class CreateUserResourcePolicyInput(graphene.InputObjectType): - max_vfolder_size = BigInt(required=True) + max_vfolder_count = graphene.Int() + max_quota_scope_size = BigInt() class ModifyUserResourcePolicyInput(graphene.InputObjectType): - max_vfolder_size = BigInt(required=True) + max_vfolder_count = graphene.Int() + max_quota_scope_size = BigInt() class CreateUserResourcePolicy(graphene.Mutation): @@ -586,7 +590,9 @@ class ProjectResourcePolicy(graphene.ObjectType): id = graphene.ID(required=True) name = graphene.String(required=True) created_at = GQLDateTime(required=True) - max_vfolder_size = BigInt() + max_vfolder_count = graphene.Int() + max_vfolder_size = BigInt(deprecation_reason="Deprecated since 23.09.1") + max_quota_scope_size = BigInt() @classmethod def from_row( @@ -657,11 +663,13 @@ async def batch_load_by_project( class CreateProjectResourcePolicyInput(graphene.InputObjectType): - max_vfolder_size = BigInt(required=True) + max_vfolder_count = graphene.Int() + max_quota_scope_size = BigInt() class ModifyProjectResourcePolicyInput(graphene.InputObjectType): - max_vfolder_size = BigInt(required=True) + max_vfolder_count = graphene.Int() + max_quota_scope_size = BigInt() class CreateProjectResourcePolicy(graphene.Mutation):