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

Upload Download Kernel Images #413

Merged
merged 18 commits into from
Oct 1, 2024
Merged

Upload Download Kernel Images #413

merged 18 commits into from
Oct 1, 2024

Conversation

Winston-Hsiao
Copy link
Collaborator

@Winston-Hsiao Winston-Hsiao commented Sep 20, 2024

What does this PR do?

Allows admins and moderators to upload Kernel Images and allows for users to download the Kernel Images from the downloads page.

Screenshot 2024-09-30 at 9 04 15 PM

@Winston-Hsiao Winston-Hsiao self-assigned this Sep 20, 2024
@Winston-Hsiao Winston-Hsiao marked this pull request as draft September 20, 2024 03:31
@Winston-Hsiao
Copy link
Collaborator Author

@codekansas

main highlights on current approach/implementation:

  1. prev artifacts/upload/{listing_id} api route now artifacts/listing-upload/{listing_id} as they're tied to listings
  2. new independent artifact upload now utilizes artifacts/upload
  3. new fields to Artifact model:
  • label with type ArtifactLabel for distinguishing between kernel image or ml weights/whatever it is we're trying to store ML wise (it was unclear from the different requests from people)
  • downloads int for tracking number of downloads we'll atomically increment that on download by signed user
  • is_official boolean
  1. Downloads page should fetch Artifacts with label "kernel" or "ml" as those are the 2 artifact types we want downloadable from this page (JX made the decision to drop URDFs from this page and have those continue to be primarily accessed via /browse)
  2. Downloads page has a button visible only to authenticated users with is_mod and is_admin permissions, and independent upload process also validates current_user has permission to upload to s3

Notes/concerns: not sure if the new independent artifact upload flow I've made is optimal or if it's not fully backwards compatible with the onshape/listing artifact flows. CRUD functionality is working but not sure about correctness with S3/cloudfront and the actual files being uploaded/to be download.

store/app/model.py Outdated Show resolved Hide resolved
@Winston-Hsiao Winston-Hsiao marked this pull request as ready for review October 1, 2024 00:37
@Winston-Hsiao
Copy link
Collaborator Author

Notes: Had to encode/decode file as Base64 string to get rid of linting/typesafe error in Download.tsx that would cause build to fail. Passing file as raw binary worked and was functionally correct, however the Kernel Image router upload endpoint expects file as a string, and form data and other variations with different request headers would not get rid of the type "string" requirement.

Can return to this to remove base64 encode/decode and pass as raw binary (save space and time) during data transfer.

@Winston-Hsiao Winston-Hsiao changed the title Upload download targz Upload Download Kernel Images Oct 1, 2024
@Winston-Hsiao Winston-Hsiao merged commit 991d854 into master Oct 1, 2024
1 check passed
@Winston-Hsiao Winston-Hsiao deleted the upload-download-targz branch October 1, 2024 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants