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

Files list end point refactor #1529

Merged
merged 23 commits into from
Nov 21, 2024
Merged

Files list end point refactor #1529

merged 23 commits into from
Nov 21, 2024

Conversation

Tansito
Copy link
Member

@Tansito Tansito commented Oct 29, 2024

Summary

This PR is part of an effort to stabilize files API end-points in #1509

This PR focuses on files/ and files/provider/ end-points to be able to list the files in the working directories for the user and for the provider.

Details and comments

  • files/ end-point was separated in two:
    • files/ now contains the paths: username/ and username/provider/function with the purpose to separated files from functions from the user's root folder
    • files/provider/ to manage the path provider/function so now each function will have its own folder in the provider directory.
  • A new service FileStorage was created to manage the logic of access to this storage for providers and users with the purpose to simplify the view.

@Tansito Tansito marked this pull request as draft October 29, 2024 15:38
@Tansito Tansito marked this pull request as ready for review October 29, 2024 15:50
@Tansito Tansito requested a review from a team October 29, 2024 15:50
@Tansito Tansito changed the title List end point refactor Files list end point refactor Oct 29, 2024
Copy link
Collaborator

@korgan00 korgan00 left a comment

Choose a reason for hiding this comment

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

Good job, just minor comments

gateway/api/views/files.py Outdated Show resolved Hide resolved
gateway/api/services/file_storage.py Outdated Show resolved Hide resolved
gateway/api/services/file_storage.py Outdated Show resolved Hide resolved
gateway/api/services/file_storage.py Outdated Show resolved Hide resolved
gateway/api/services/file_storage.py Outdated Show resolved Hide resolved
gateway/api/services/file_storage.py Outdated Show resolved Hide resolved
@Tansito
Copy link
Member Author

Tansito commented Nov 7, 2024

Thank you so much @korgan00 , as soon as I return from vacations I will take a look 🙏

gateway/api/services/file_storage.py Outdated Show resolved Hide resolved
gateway/api/views/files.py Outdated Show resolved Hide resolved
gateway/api/views/files.py Outdated Show resolved Hide resolved
gateway/api/views/files.py Outdated Show resolved Hide resolved
@Tansito Tansito requested a review from korgan00 November 20, 2024 18:17
@Tansito
Copy link
Member Author

Tansito commented Nov 20, 2024

Apart from the comment from enum I think I addressed all your comments, @korgan00 . Thank you so much for the review, definitely it got quite better the PR.

Copy link
Collaborator

@korgan00 korgan00 left a comment

Choose a reason for hiding this comment

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

Looks very good, some minor extra comments

gateway/api/services/file_storage.py Outdated Show resolved Hide resolved
gateway/api/services/file_storage.py Outdated Show resolved Hide resolved
gateway/api/views/files.py Outdated Show resolved Hide resolved
@Tansito Tansito requested a review from korgan00 November 20, 2024 18:53
@Tansito
Copy link
Member Author

Tansito commented Nov 20, 2024

I closed the conversation around the enum assuming is fine for you, @korgan00 👍

@Tansito Tansito merged commit 71542fd into data-folder Nov 21, 2024
7 checks passed
@Tansito Tansito deleted the list-end-point branch November 21, 2024 14:13
@Tansito Tansito mentioned this pull request Dec 16, 2024
Tansito added a commit that referenced this pull request Jan 13, 2025
* Create services storage script

* Files list end point refactor (#1529)

* First refactorization for files

* Completed use cases for list end-point

* Renamed storage to file_storage

* Migrated files to file_storage

* Migrated get files to the new service

* Check if function exists first

* Separated end-points to the new provider

* Improved tests

* Restore original fixtures

* Solved the problem with the external if

* Added Literal type in the FileStorage service

* functions methods refactorization

* use self.username instead of the variable

* run path sanitization only one time

* function title is mandatory for file storage

* fix black

* Updated 403 by 404

* Updated swagger for list

* Makes use of enum with integers

* use is instead of equals

* unify path build

* get_function refactor

* Add support new files (#1546)

* new list files for the gateway refactor

* unify files url

* remove enum and linter

* remove provider parameter

* Check provider

* Download end point refactor (#1547)

* refactor of download end-points

* additional test to check non existing file

* renamed files test to v1_files

* added additional checks for the query

* included the checks in the list end-point

* include swagger documentation updated

* remove unneeded try except

* make use of regex instead of a manual parsing

* check not all instead of None

* rename file_extension_is_valid

* Update gateway/api/utils.py

Co-authored-by: Goyo <[email protected]>

---------

Co-authored-by: Goyo <[email protected]>

* add support to new download files endpoints (#1550)

* Gateway/delete end point (#1554)

* add support to new delete files endpoints

* fix get parameter

* fix tests

* delete programDelete fixture

* update file_storage/remove_file description

* Upload end point (#1555)

* Update upload end-point

* removed unused imports

* updated comment in upload end-point

* remove file extension limitation from files (#1559)

* Client - files upload refactor (#1557)

* add support to new upload file endpoints

* replace data with params

* Client - files delete refactor (#1556)

* add support to new delete files endpoints

* fix get parameter

* fix tests

* adapt files delete to the refactor

* replace data with params

* remove not used fixture

* Integration tests fix (#1561)

* add support to new delete files endpoints

* fix get parameter

* fix tests

* adapt files delete to the refactor

* replace data with params

* remove not used fixture

* tests fixed

* fix client integration

* fix context manager in files when download

* added a new test for provider end-points

* fix black

* migrated old tests

* Update gateway/api/services/file_storage.py

Co-authored-by: Goyo <[email protected]>

* remove additional line

---------

Co-authored-by: David <[email protected]>

* Trace decorator (#1553)

* create a trace decorator

* fix decorator

* change documentation

---------

Co-authored-by: David <[email protected]>

* Files refactor to include repositories logic (#1560)

* remove unneeded provider methods

* create access policies file

* refactor get_functions repository method

* refactor groups and repositories

* repository refactor from files

* fix some linter problems

* fixed a bug when the user retrieves a function

* fix lint

* refactor of get_function method

* remove artifact test file

* remove programs access policies

* refactor programs references to functions

* group repository refactor

* rename groups repository into user repository

* simplified get_function methods

* fix query

* adapt get_functions methods

* updated comments

* create path if doesn't exist

* remove some unused code

* fix files client

* fix typos

* fixed the creation of the directory

* added a test for the provider end-points

* fix some typos from the provider end-points

* fix black on tests

* files documentation updated (#1565)

* Refactor storage in scheduler (#1563)

* refactor storage in scheduler

* fix typo in ray template

* remove unused node_image

* use sub-paths for the cluster template

* storage absolute path refactor

* docstrings updated in the client

---------

Co-authored-by: Goyo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants