-
-
Notifications
You must be signed in to change notification settings - Fork 1
Upload a chunk at a time #296
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #296 +/- ##
==========================================
+ Coverage 77.77% 78.23% +0.46%
==========================================
Files 142 142
Lines 11143 11152 +9
Branches 1185 1184 -1
==========================================
+ Hits 8666 8725 +59
+ Misses 2057 1999 -58
- Partials 420 428 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1781faa
to
6529f9c
Compare
d45e684
to
edddc94
Compare
edddc94
to
d96581d
Compare
if missing: | ||
logger.warning(f"{len(missing)} chunks failed to upload") | ||
else: | ||
logger.warning("Assembly failed but no missing chunks reported") | ||
return result | ||
|
||
logger.info(f"Re-uploading {len(missing)} missing chunks") | ||
if not self._upload_chunks(org, chunks, missing): | ||
logger.warning(f"Some chunks failed to re-upload on attempt {attempt + 1}") | ||
return result |
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.
The assembly process no longer attempts to re-upload missing chunks when they're reported. This removes an important recovery mechanism from the original implementation.
In the previous code, when chunks were missing, it would:
logger.info(f"Re-uploading {len(missing)} missing chunks")
if not self._upload_chunks(org, chunks, missing):
logger.warning(f"Some chunks failed to re-upload on attempt {attempt + 1}")
The new implementation simply logs a warning and returns the error result immediately. This could lead to failed uploads that might have succeeded with the retry mechanism. Consider restoring the chunk re-upload functionality to maintain the same resilience as the original implementation.
if missing: | |
logger.warning(f"{len(missing)} chunks failed to upload") | |
else: | |
logger.warning("Assembly failed but no missing chunks reported") | |
return result | |
logger.info(f"Re-uploading {len(missing)} missing chunks") | |
if not self._upload_chunks(org, chunks, missing): | |
logger.warning(f"Some chunks failed to re-upload on attempt {attempt + 1}") | |
return result | |
if missing: | |
logger.info(f"Re-uploading {len(missing)} missing chunks") | |
if not self._upload_chunks(org, chunks, missing): | |
logger.warning(f"{len(missing)} chunks failed to re-upload") | |
else: | |
logger.warning("Assembly failed but no missing chunks reported") | |
return result |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
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.
+1
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 want to put this in loop so it starts with an assemble then only uploads the missing chunks. I'll do it in a follow up if that works for you.
d96581d
to
29b9252
Compare
afb441d
to
3d38885
Compare
3d38885
to
577433b
Compare
@@ -148,40 +177,66 @@ def upload_installable_app( | |||
org: str, | |||
project: str, | |||
artifact_id: str, | |||
file_path: str, | |||
file: str | io.BytesIO, |
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 this intentional? i dont see any changes to service.py
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.
Right now only the tests use this but ideally I think it would be better to pass around file objects rather than paths. That way it's much harder to accidentally either fail to delete something (so leaking the disk space till the process dies) or deleting something too soon (and causing crashes).
I want to update the calling code to pass the arguments as files, then we can delete the 'file_path' handling (here + all of _upload_path_with_assembly) but not in this PR.
if missing: | ||
logger.warning(f"{len(missing)} chunks failed to upload") | ||
else: | ||
logger.warning("Assembly failed but no missing chunks reported") | ||
return result | ||
|
||
logger.info(f"Re-uploading {len(missing)} missing chunks") | ||
if not self._upload_chunks(org, chunks, missing): | ||
logger.warning(f"Some chunks failed to re-upload on attempt {attempt + 1}") | ||
return result |
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.
+1
Update
sentry_client.py
to not need the whole file in memory at once.sentry_client.py
was reading whole files at once to chunk them up and send themto the monolith. This was bad for build distribution which sends a whole app back
to the monolith since it caused large spikes in memory usage as the apps can be ~X00mb.
While here we make a number of simplifications:
with the built in requests encoding + a custom auth provider.
requests
which seems useful here and allows less fragile mocking in the tests.which again allows for simpler tests.
go though for real.