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

fix: LEAP-884: avoid reading entire files to memory in export api #5612

Merged
merged 11 commits into from
Apr 25, 2024

Conversation

jombooth
Copy link
Contributor

@jombooth jombooth commented Mar 20, 2024

Resolves #5243

High level idea is to avoid calling f.read() in the ExportAPI, using shutil.copy2 instead where we can.

Tested:

  • with CI, for single file exports. eg pytest tests/sdk/test_tasks.py::test_export_tasks
  • manually, for exporting an archive
  • using label-studio export, for the tasks.functions change
  • using pytest tests/data_export.tavern.yml, for the export mixin change.

Copy link

netlify bot commented Mar 20, 2024

Deploy Preview for heartex-docs canceled.

Name Link
🔨 Latest commit 100bfbb
🔍 Latest deploy log https://app.netlify.com/sites/heartex-docs/deploys/662895c106b4ff0008bcfa9d

@github-actions github-actions bot added the fix label Mar 20, 2024
Copy link

netlify bot commented Mar 20, 2024

Deploy Preview for label-studio-docs-new-theme canceled.

Name Link
🔨 Latest commit 100bfbb
🔍 Latest deploy log https://app.netlify.com/sites/label-studio-docs-new-theme/deploys/662895c1b77a3e0008c4d82c

Copy link

codecov bot commented Mar 20, 2024

Codecov Report

Attention: Patch coverage is 95.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 75.93%. Comparing base (066f74b) to head (100bfbb).
Report is 2 commits behind head on develop.

Files Patch % Lines
label_studio/data_export/models.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5612   +/-   ##
========================================
  Coverage    75.92%   75.93%           
========================================
  Files          158      158           
  Lines        13359    13363    +4     
========================================
+ Hits         10143    10147    +4     
  Misses        3216     3216           
Flag Coverage Δ
pytests 75.93% <95.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

label_studio/core/utils/io.py Show resolved Hide resolved
label_studio/data_export/api.py Show resolved Hide resolved
label_studio/data_export/mixins.py Show resolved Hide resolved
@makseq makseq requested a review from triklozoid March 21, 2024 00:47
@jombooth
Copy link
Contributor Author

jombooth commented Mar 21, 2024

With the Windows failures, we can't merge this as is. Finding a solution will require a bit more time.

Update 4/24: seems to be fixed via Django's NamedTemporaryFile

@jombooth jombooth merged commit 5e2e552 into develop Apr 25, 2024
37 checks passed
@jombooth jombooth deleted the fb-LEAP-884/easy-export-revised branch April 25, 2024 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Easy Export to YOLO format causes absurd memory usage
3 participants