Skip to content

Commit f1c068d

Browse files
jopemachineclaude
andauthored
feat(BA-6054): expose subpath on v2 REST/GraphQL session MountItemInput (#11628)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent de5cae7 commit f1c068d

8 files changed

Lines changed: 35 additions & 3 deletions

File tree

changes/11628.feature.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Expose `subpath` on the v2 REST/GraphQL session `MountItemInput` so `EnqueueSession` callers can mount a vfolder subpath. Follow-up to #11608, which only exposed `subpath` on the legacy `CreationConfigV*.mount_options` wire schema.

docs/manager/graphql-reference/supergraph.graphql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17112,6 +17112,11 @@ input SessionMountItemInput
1711217112

1711317113
"""Mount permission ('rw' or 'ro')."""
1711417114
permission: String = null
17115+
17116+
"""
17117+
Added in UNRELEASED. Subpath within the vfolder to mount. Null mounts the vfolder root.
17118+
"""
17119+
subpath: String = null
1711517120
}
1711617121

1711717122
"""Added in 25.13.0."""

docs/manager/graphql-reference/v2-schema.graphql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11636,6 +11636,11 @@ input SessionMountItemInput {
1163611636

1163711637
"""Mount permission ('rw' or 'ro')."""
1163811638
permission: String = null
11639+
11640+
"""
11641+
Added in UNRELEASED. Subpath within the vfolder to mount. Null mounts the vfolder root.
11642+
"""
11643+
subpath: String = null
1163911644
}
1164011645

1164111646
"""Added in 26.4.2. Additional resource options for session creation."""

src/ai/backend/common/dto/manager/v2/model_serving/request.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
from __future__ import annotations
66

7-
from typing import Any
87
from uuid import UUID
98

109
from pydantic import ConfigDict, Field, NonNegativeFloat, field_validator
1110

1211
from ai.backend.common.api_handlers import BaseRequestModel
12+
from ai.backend.common.dto.manager.session.types import MountOption
1313
from ai.backend.common.types import RuntimeVariant
1414

1515
__all__ = (
@@ -36,9 +36,12 @@ class ServiceConfigInput(BaseRequestModel):
3636
default="/models",
3737
description="Mount destination for the model VFolder inside the inference session",
3838
)
39-
extra_mounts: dict[UUID, Any] = Field(
39+
extra_mounts: dict[UUID, MountOption] = Field(
4040
default_factory=dict,
41-
description="Extra VFolders mounted to model service session",
41+
description=(
42+
"Extra VFolders mounted to the model service session, keyed by vfolder UUID."
43+
" Each value carries per-mount options (mount destination, permission, subpath)."
44+
),
4245
)
4346
environ: dict[str, str] | None = Field(
4447
default=None,

src/ai/backend/common/dto/manager/v2/session/request.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,14 @@ class MountItemInput(BaseRequestModel):
261261
permission: str | None = Field(
262262
default=None, description="Mount permission override ('rw' or 'ro')."
263263
)
264+
subpath: str | None = Field(
265+
default=None,
266+
min_length=1,
267+
description=(
268+
"Subpath within the vfolder to mount. Omit (null) to mount the vfolder root."
269+
" Empty string is rejected."
270+
),
271+
)
264272

265273

266274
class BatchConfigInput(BaseRequestModel):

src/ai/backend/manager/api/adapter_options/session/options.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ def _mount_items_to_entries(items: Sequence[MountItemInput]) -> list[MountInfoEn
200200
vfolder_id=VFolderUUID(item.vfolder_id),
201201
mount_destination=item.mount_path,
202202
mount_perm=perm or MountPermission.READ_WRITE,
203+
subpath=item.subpath,
203204
)
204205
)
205206
return result

src/ai/backend/manager/api/adapters/session/adapter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ async def enqueue(
251251
vfolder_id=VFolderUUID(m.vfolder_id),
252252
mount_destination=m.mount_path,
253253
mount_perm=(MountPermission(m.permission) if m.permission else None),
254+
subpath=m.subpath,
254255
)
255256
for m in input.mounts
256257
]

src/ai/backend/manager/api/gql/session/types.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
ProjectSessionScope,
5252
SessionStatusFilter,
5353
)
54+
from ai.backend.common.meta.meta import NEXT_RELEASE_VERSION
5455
from ai.backend.common.types import ImageID, SessionId
5556
from ai.backend.manager.api.gql.base import OrderDirection, StringFilter, UUIDFilter, encode_cursor
5657
from ai.backend.manager.api.gql.common.types import (
@@ -533,6 +534,13 @@ class SessionMountItemInputGQL(PydanticInputMixin[MountItemInputDTO]):
533534
vfolder_id: ID = gql_field(description="Virtual folder UUID.")
534535
mount_path: str | None = gql_field(default=None, description="Custom mount path.")
535536
permission: str | None = gql_field(default=None, description="Mount permission ('rw' or 'ro').")
537+
subpath: str | None = gql_added_field(
538+
BackendAIGQLMeta(
539+
added_version=NEXT_RELEASE_VERSION,
540+
description="Subpath within the vfolder to mount. Null mounts the vfolder root.",
541+
),
542+
default=None,
543+
)
536544

537545

538546
@gql_pydantic_input(

0 commit comments

Comments
 (0)