Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(BA-682): Update vfolder CLI cmd to support unmanaged vfolders #3631

Open
wants to merge 3 commits into
base: topic/02-10-feat_assign_unmanaged_vfolders_to_noop_storage_host
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/3631.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update vfolder CLI cmd to support unmanaged vfolders
41 changes: 22 additions & 19 deletions src/ai/backend/client/cli/vfolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,22 @@ def list_allowed_types():
"host_path",
is_flag=True,
help=(
"Deprecated since 25.3.0. Use `--unmanaged-path` instead. "
"Treats HOST as a mount point of unmanaged virtual folder. "
"This option can only be used by Admin or Superadmin."
),
)
@click.option(
"--unmanaged-path",
"unmanaged_path",
metavar="UNMANAGED_PATH",
type=str,
default=None,
help=(
"Map a given host path to a virtual folder. "
"This option can only be used by Admin or Superadmin."
),
)
@click.option(
"-m",
"--usage-mode",
Expand Down Expand Up @@ -115,7 +127,7 @@ def list_allowed_types():
is_flag=True,
help="Allows the virtual folder to be cloned by users.",
)
def create(name, host, group, host_path, usage_mode, permission, cloneable):
def create(name, host, group, host_path, unmanaged_path, usage_mode, permission, cloneable):
"""Create a new virtual folder.

\b
Expand All @@ -124,24 +136,15 @@ def create(name, host, group, host_path, usage_mode, permission, cloneable):
"""
with Session() as session:
try:
if host_path:
result = session.VFolder.create(
name=name,
unmanaged_path=host,
group=group,
usage_mode=usage_mode,
permission=permission,
cloneable=cloneable,
)
else:
result = session.VFolder.create(
name=name,
host=host,
group=group,
usage_mode=usage_mode,
permission=permission,
cloneable=cloneable,
)
result = session.VFolder.create(
name=name,
host=host,
unmanaged_path=unmanaged_path,
group=group,
usage_mode=usage_mode,
permission=permission,
cloneable=cloneable,
)
print('Virtual folder "{0}" is created.'.format(result["name"]))
except Exception as e:
print_error(e)
Expand Down
Loading