-
Notifications
You must be signed in to change notification settings - Fork 113
Add FileService as a standalone microservice, LakeFS+S3 as dataset storage #3296
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
Merged
Merged
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
1a705ae
add initial lake fs based implementation
bobbai00 978c528
move lakefs logic to workflow core
bobbai00 cfd84b3
add uri related and lake fs document
bobbai00 ec3baf6
fix bugs
bobbai00 779f1df
a compilable version
bobbai00 a8bd16e
a runnable version
bobbai00 8ef7927
finish jwt auth
bobbai00 583ce58
make the backend work
bobbai00 3e1d0d6
keep refactoring the dataset resource
bobbai00 c690e8c
succinct the config parsing
bobbai00 2c93de6
test more APIs and closing to finish
bobbai00 dafa6e0
fix dataset creation and version creation
bobbai00 8ebccfb
fix the presigned get
bobbai00 7e3ad39
closing to finish the upload
bobbai00 b980628
refactor dataset frontend
bobbai00 01221f3
finish upload
bobbai00 1b46692
closing to finish the gui
bobbai00 7df961e
delete the lakefs test as the test environment don't have it
bobbai00 1fd8718
keep improving the backend and frontend
bobbai00 7416e1d
make the workflow be able to read from the dataset
bobbai00 e7a3b5c
adding python side dataset reader
bobbai00 1303092
keep improving the frontend
bobbai00 e4b7649
clean up the frontend
bobbai00 cf28dee
finish the export
bobbai00 280aad0
finalize the sharing feature
bobbai00 d53fd75
fix the delete
bobbai00 76b7e7e
recover the frontend change
bobbai00 ed44b77
fix test
bobbai00 b9cdfde
fix backend dependency and fix frontend
bobbai00 07464a9
cleanup the storage config
bobbai00 602033a
add more comments
bobbai00 074ff46
save the multipart chunk change on frontend
bobbai00 ae78df1
recover gui changes
bobbai00 4f83db0
do the rebase
bobbai00 166b1f2
add the flag for controlling whether to select files from dataset
bobbai00 ba9dfcf
add default values for lakeFS+S3
bobbai00 b356e76
fmt
bobbai00 0c26e27
add file service to part of the scripts
bobbai00 1d71e74
resolve comments and fix the py udf document
bobbai00 ee60cf9
fmt python
bobbai00 de73637
fmt and fix the version of docker compose
bobbai00 2e0ab31
try to fix the cors issue
bobbai00 f9bc34e
fmt py file
bobbai00 0c55cff
add header for put
bobbai00 fe03345
fmt UDF
bobbai00 efa49fe
keep refining
bobbai00 77467a5
update the docker compose
bobbai00 cf8d460
remove the header in the dataset.service.ts fetch
bobbai00 b470e18
improve the upload
bobbai00 5620944
add the concurrency in the config
bobbai00 ab37cf0
add more comments on the env
bobbai00 ef43ca9
add cancel feature
bobbai00 e294ac7
add the bold
bobbai00 bebc938
fmt
bobbai00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from .dataset_file_document import DatasetFileDocument | ||
|
|
||
| __all__ = ["DatasetFileDocument"] |
81 changes: 81 additions & 0 deletions
81
core/amber/src/main/python/pytexera/storage/dataset_file_document.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import os | ||
| import io | ||
| import requests | ||
| import urllib.parse | ||
|
|
||
|
|
||
| class DatasetFileDocument: | ||
| def __init__(self, file_path: str): | ||
| """ | ||
| Parses the file path into dataset metadata. | ||
|
|
||
| :param file_path: | ||
| Expected format - "/ownerEmail/datasetName/versionName/fileRelativePath" | ||
| Example: "/bob@texera.com/twitterDataset/v1/california/irvine/tw1.csv" | ||
| """ | ||
| parts = file_path.strip("/").split("/") | ||
| if len(parts) < 4: | ||
| raise ValueError( | ||
| "Invalid file path format. " | ||
| "Expected: /ownerEmail/datasetName/versionName/fileRelativePath" | ||
| ) | ||
|
|
||
| self.owner_email = parts[0] | ||
| self.dataset_name = parts[1] | ||
| self.version_name = parts[2] | ||
| self.file_relative_path = "/".join(parts[3:]) | ||
|
|
||
| self.jwt_token = os.getenv("USER_JWT_TOKEN") | ||
| self.presign_endpoint = os.getenv("PRESIGN_API_ENDPOINT") | ||
|
|
||
| if not self.jwt_token: | ||
| raise ValueError( | ||
| "JWT token is required but not set in environment variables." | ||
| ) | ||
| if not self.presign_endpoint: | ||
| self.presign_endpoint = "http://localhost:9092/api/dataset/presign-download" | ||
|
|
||
| def get_presigned_url(self) -> str: | ||
| """ | ||
| Requests a presigned URL from the API. | ||
|
|
||
| :return: The presigned URL as a string. | ||
| :raises: RuntimeError if the request fails. | ||
| """ | ||
| headers = {"Authorization": f"Bearer {self.jwt_token}"} | ||
| encoded_file_path = urllib.parse.quote( | ||
| f"/{self.owner_email}" | ||
| f"/{self.dataset_name}" | ||
| f"/{self.version_name}" | ||
| f"/{self.file_relative_path}" | ||
| ) | ||
|
|
||
| params = {"filePath": encoded_file_path} | ||
|
|
||
| response = requests.get(self.presign_endpoint, headers=headers, params=params) | ||
|
|
||
| if response.status_code != 200: | ||
| raise RuntimeError( | ||
| f"Failed to get presigned URL: " | ||
| f"{response.status_code} {response.text}" | ||
| ) | ||
|
|
||
| return response.json().get("presignedUrl") | ||
|
|
||
| def read_file(self) -> io.BytesIO: | ||
| """ | ||
| Reads the file content from the presigned URL. | ||
|
|
||
| :return: A file-like object. | ||
| :raises: RuntimeError if the retrieval fails. | ||
| """ | ||
| presigned_url = self.get_presigned_url() | ||
| response = requests.get(presigned_url) | ||
|
|
||
| if response.status_code != 200: | ||
| raise RuntimeError( | ||
| f"Failed to retrieve file content: " | ||
| f"{response.status_code} {response.text}" | ||
| ) | ||
|
|
||
| return io.BytesIO(response.content) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.