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

[Bug fix] Fixes boto3 credentials reload issue in hub compute #1562

Merged
merged 5 commits into from
Mar 25, 2022

Conversation

AbhinavTuli
Copy link
Contributor

🚀 🚀 Pull Request

Checklist:

  • My code follows the style guidelines of this project and the Contributing document
  • I have commented my code, particularly in hard-to-understand areas
  • I have kept the coverage-rate up
  • I have performed a self-review of my own code and resolved any problems
  • I have checked to ensure there aren't any other open Pull Requests for the same change
  • I have described and made corresponding changes to the relevant documentation
  • New and existing unit tests pass locally with my changes

Changes

if isinstance(storage, MemoryProvider):
storages = [storage] * len(slices)
else:
storages = [storage.copy() for _ in slices]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

creating proper copies of storage to prevent reuse of boto3 resource across workers

self.client = boto3.client("s3", **args)
self.resource = boto3.resource("s3", **args)
session = boto3.session.Session(profile_name=self.profile_name)
self.client = session.client("s3", **args)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

instantiating from session instead of boto3.client makes this threadsafe

@codecov
Copy link

codecov bot commented Mar 23, 2022

Codecov Report

Merging #1562 (4b92ebe) into main (8a51d43) will increase coverage by 0.01%.
The diff coverage is 71.42%.

@@            Coverage Diff             @@
##             main    #1562      +/-   ##
==========================================
+ Coverage   92.34%   92.36%   +0.01%     
==========================================
  Files         199      199              
  Lines       17939    17943       +4     
==========================================
+ Hits        16566    16573       +7     
+ Misses       1373     1370       -3     
Flag Coverage Δ
unittests 92.36% <71.42%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
hub/core/storage/provider.py 100.00% <ø> (ø)
hub/core/storage/s3.py 69.17% <53.84%> (ø)
hub/core/transform/transform.py 97.97% <100.00%> (+0.08%) ⬆️
hub/util/transform.py 93.75% <100.00%> (ø)
hub/core/lock.py 89.47% <0.00%> (+1.97%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a51d43...4b92ebe. Read the comment docs.

@AbhinavTuli AbhinavTuli merged commit 536aa88 into main Mar 25, 2022
@AbhinavTuli AbhinavTuli deleted the fix/boto3_threading_issue branch March 25, 2022 19:13
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