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

documents uploads will use HDFSfileUploadHandler when task_server is on #4044

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

athithyaaselvam
Copy link
Collaborator

What changes were proposed in this pull request?

Import documents in documents tab are failing, when task server is enabled with error
" File "/opt/hive/desktop/core/src/desktop/api2.py", line 1027, in import_documents
raise PopupException(_('Failed to import documents, the file does not contain valid JSON.'))".

This was because the document upload handler was using FineUploaderChunkedUploadHandler when the is_chunked_fileuploader_enabled flag is on. No supporting logic was added to FineUploaderChunkedUploadHandler to support document uploads as the main motive of FineUploaderChunkedUploadHandler was to support large file uploads.

So adding a custom upload handler that will delegate the document upload tasks to the HDFSfileUploadHandler and rest of the file uploads to FineUploaderChunkedUploadHandler when is_chunked_fileuploader_enabled is on.

How was this patch tested?

-tested local setup and Kubernetes setup

Please review Hue Contributing Guide before opening a pull request.

@athithyaaselvam athithyaaselvam requested a review from ranade1 March 12, 2025 00:10
Copy link

⚠️ No unit test files modified. Please ensure that changes are properly tested. ⚠️

Copy link

github-actions bot commented Mar 12, 2025

Backend Codecov

Backend Code Coverage Report •
FileStmtsMissCoverMissing
desktop/libs/hadoop/src/hadoop/fs
   upload.py31824024%49–58, 60–64, 67, 70, 73–74, 79–89, 91–95, 98–99, 102–105, 107–109, 111–112, 116–119, 121–127, 129–138, 140–141, 144–145, 158–164, 167–168, 171–172, 175–179, 181–183, 185, 188, 193, 196, 199–204, 207–212, 215, 218, 221, 238, 240–248, 257–259, 267–268, 303–304, 306–310, 312–322, 324, 327, 329–330, 332–333, 335–341, 344–345, 347–351, 353–355, 363–367, 369, 371, 374, 376–379, 381–384, 386, 389, 391–397, 400–404, 406–408, 411–413, 415, 418–420, 423–425, 427, 436–439, 441, 444–447, 449–450, 452, 454, 457, 460, 463, 466–471, 474–479, 482, 485, 488
TOTAL533082612550% 

Pytest Report

Tests Skipped Failures Errors Time
1088 107 💤 0 ❌ 0 🔥 5m 43s ⏱️

Copy link

⚠️ No unit test files modified. Please ensure that changes are properly tested. ⚠️

Copy link
Collaborator

@Harshg999 Harshg999 left a comment

Choose a reason for hiding this comment

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

Nice change! I've left few review comments.
Also can you add unit tests please?


def __init__(self, request, *args, **kwargs):
super().__init__(request, *args, **kwargs)
if request.path.startswith("/desktop/api2/doc/import"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Try using reverse() instead of hardcoding here?

Comment on lines +236 to +238
self.delegate = HDFSfileUploadHandler(request)
else:
self.delegate = FineUploaderChunkedUploadHandler(request, *args, **kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Better variable naming? Something related to upload handler?

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.

3 participants