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: Accept multiple paths in the vfolder mkdir API #1803

Merged
merged 26 commits into from
Feb 27, 2024

Conversation

mirageoasis
Copy link
Collaborator

@mirageoasis mirageoasis commented Dec 21, 2023

This PR adds an extra feature to specify multiple directories in the vfolder mkdir API to create them via a single API call.

  • Allow passing multiple relative paths of directores to create via nargs in click.option
  • Add '-p' option to auto-create parent directories recursively

The feature itself is a relatively small addition, but this PR demonstrates how we are going to design and implement multi-result (or batch) APIs.

  • Introduce common.types.{ItemResult,ResultSet} to distinguish success/failed results, with optional error messages attached to each item.
  • The HTTP response codes will be segregated as follows:
    • 200: All success
    • 207: Partial success/failure (from WebDAV)
    • 422: All failure (semantic failure, not server error) (from WebDAV)

Examples

Partial success (console output):
image

Partial success (JSON output):
image

All failed (JSON output):
image

@github-actions github-actions bot added comp:client Related to Client component size:S 10~30 LoC labels Dec 21, 2023
@mirageoasis mirageoasis requested a review from fregataa December 21, 2023 08:08
@github-actions github-actions bot added comp:manager Related to Manager component comp:storage-proxy Related to Storage proxy component size:M 30~100 LoC and removed size:S 10~30 LoC labels Dec 21, 2023
@mirageoasis mirageoasis marked this pull request as ready for review December 21, 2023 14:31
Copy link
Member

@fregataa fregataa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good!
I left some comments

src/ai/backend/client/cli/vfolder.py Outdated Show resolved Hide resolved
src/ai/backend/client/func/vfolder.py Outdated Show resolved Hide resolved
src/ai/backend/manager/api/vfolder.py Outdated Show resolved Hide resolved
src/ai/backend/manager/api/vfolder.py Outdated Show resolved Hide resolved
src/ai/backend/manager/api/vfolder.py Outdated Show resolved Hide resolved
src/ai/backend/storage/api/manager.py Outdated Show resolved Hide resolved
@mirageoasis mirageoasis requested a review from fregataa December 22, 2023 06:42
Copy link
Member

@fregataa fregataa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some more comments!

src/ai/backend/client/func/vfolder.py Outdated Show resolved Hide resolved
src/ai/backend/client/func/vfolder.py Outdated Show resolved Hide resolved
changes/1803.feature.md Outdated Show resolved Hide resolved
src/ai/backend/storage/api/manager.py Outdated Show resolved Hide resolved
@mirageoasis mirageoasis requested a review from fregataa December 23, 2023 22:24
src/ai/backend/storage/api/manager.py Outdated Show resolved Hide resolved
src/ai/backend/storage/api/manager.py Outdated Show resolved Hide resolved
@github-actions github-actions bot added size:L 100~500 LoC and removed size:M 30~100 LoC labels Dec 28, 2023
Copy link
Member

@fregataa fregataa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good!
I checked the functionality and it works well.
I left a few comment about typing

src/ai/backend/storage/api/manager.py Outdated Show resolved Hide resolved
src/ai/backend/storage/api/manager.py Outdated Show resolved Hide resolved
@mirageoasis
Copy link
Collaborator Author

@achimnol
finished with issue #409 !

@achimnol achimnol added this to the 24.03 milestone Jan 9, 2024
@mirageoasis mirageoasis changed the title feature: now accepts multiple mkdir feat: now accepts multiple mkdir Jan 22, 2024
src/ai/backend/storage/api/manager.py Outdated Show resolved Hide resolved
src/ai/backend/client/cli/vfolder.py Outdated Show resolved Hide resolved
@achimnol achimnol changed the title feat: now accepts multiple mkdir feat: Accept multiple paths in the vfolder mkdir API Jan 30, 2024
src/ai/backend/manager/api/vfolder.py Outdated Show resolved Hide resolved
@achimnol achimnol enabled auto-merge February 27, 2024 14:01
@achimnol achimnol disabled auto-merge February 27, 2024 14:02
@achimnol achimnol enabled auto-merge February 27, 2024 14:05
@mirageoasis
Copy link
Collaborator Author

Totally different api from what I first wrote! amazing!
More fined grained reports!

@achimnol achimnol added this pull request to the merge queue Feb 27, 2024
Merged via the queue into main with commit c630fb7 Feb 27, 2024
30 checks passed
@achimnol achimnol deleted the feature/accept-multiple-mkdir branch February 27, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:client Related to Client component comp:manager Related to Manager component comp:storage-proxy Related to Storage proxy component size:L 100~500 LoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants