Skip to content

Commit

Permalink
Merge branch 'main' into fix/user-group-unique-constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
achimnol authored Feb 1, 2024
2 parents 17cd425 + ba086b5 commit 2bb2c62
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions changes/1850.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix mistakes on SQL queries in the manager's vfolder share API handler when checking target user's status and inconsistent where clauses in the vfolder ownership change API
1 change: 1 addition & 0 deletions changes/1873.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enqueue session with `use_host_network` field along the scaling_group to which the session belongs.
11 changes: 8 additions & 3 deletions src/ai/backend/manager/api/vfolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2026,7 +2026,7 @@ async def share(request: web.Request, params: Any) -> web.Response:
(users.c.email.in_(params["emails"]))
& (users.c.email != request["user"]["email"])
& (agus.c.group_id == vf_info["group"])
& (users.c.status == ACTIVE_USER_STATUSES),
& (users.c.status.in_(ACTIVE_USER_STATUSES)),
)
)
result = await conn.execute(query)
Expand All @@ -2045,7 +2045,7 @@ async def share(request: web.Request, params: Any) -> web.Response:

# Do not share to users who have already been shared the folder.
query = (
sa.select([vfolder_permissions.c.user])
sa.select([vfolder_permissions])
.select_from(vfolder_permissions)
.where(
(vfolder_permissions.c.user.in_(users_to_share))
Expand Down Expand Up @@ -3212,7 +3212,12 @@ async def change_vfolder_ownership(request: web.Request, params: Any) -> web.Res
)
async with root_ctx.db.begin_readonly() as conn:
query = (
sa.select([vfolders.c.host]).select_from(vfolders).where(vfolders.c.id == vfolder_id)
sa.select([vfolders.c.host])
.select_from(vfolders)
.where(
(vfolders.c.id == vfolder_id)
& (vfolders.c.ownership_type == VFolderOwnershipType.USER)
)
)
folder_host = await conn.scalar(query)
if folder_host not in allowed_hosts_by_user:
Expand Down
1 change: 1 addition & 0 deletions src/ai/backend/manager/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,7 @@ async def enqueue_session(
"callback_url": callback_url,
"occupying_slots": ResourceSlot(),
"vfolder_mounts": vfolder_mounts,
"use_host_network": use_host_network,
}

kernel_shared_data = {
Expand Down

0 comments on commit 2bb2c62

Please sign in to comment.