-
Notifications
You must be signed in to change notification settings - Fork 468
feat: Stream S3 organisation exports #6612
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Docker builds report
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6612 +/- ##
==========================================
+ Coverage 98.20% 98.24% +0.04%
==========================================
Files 1298 1301 +3
Lines 47108 47262 +154
==========================================
+ Hits 46262 46434 +172
+ Misses 846 828 -18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9fdb083 to
502c108
Compare
emyller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm interested in experimenting this right now.
When is the S3 object URL made available to the requester?
@emyller The current process is to retrieve it manually. |
matthewelwell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good on the whole - one question on the testing approach.
|
|
||
| @pytest.fixture | ||
| def s3_client() -> MagicMock: | ||
| client = MagicMock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't we use moto here to test this more realistically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 8f8b385 (which includes a bugfix thanks to moto usage!)
02c43d4 to
8f8b385
Compare
emyller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple non-blocking comments. Otherwise LGTM!
| # When | ||
| try: | ||
| with S3MultipartUploadWriter(s3_client, bucket_name, key) as writer: | ||
| writer.write(b"some data") | ||
| raise ValueError("test error") | ||
| except ValueError: | ||
| pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I'd see value in wrapping this under pytest.raises, as we're also validating S3MultipartUploadWriter re-raises.
| """ | ||
|
|
||
| # S3 multipart upload minimum part size is 5MB (except for the last part) | ||
| MIN_PART_SIZE = 5 * 1024 * 1024 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is MIN_PART_SIZE = every chunk size?
IMO this could be a greater value that helps reducing network round trips without compromising the app's memory, e.g. 64MB:
- If export < 100MB, two chunks are good!
- Otherwise, a recent realistic example could go from 250 chunks to 20.
Also worth noting: our Customer Success KB recommends an ECS task with a lot of memory.
- Reminder: update it to spend less resources.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Contributes to #6610.
In this PR, we avoid OOM worker terminations when attempting to export beefy organisations via the sales dashboard.
We assume that using generators and multipart S3 uploads should significantly reduce the memory footprint. The tradeoff is that the exports should take slightly longer.
How did you test this code?
All the new code and changes to existing code are covered with tests. This will be tested manually on staging.