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] Stop accessing underlying storage for checking encoder existence #1417

Merged
merged 4 commits into from
Dec 30, 2021

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

@AbhinavTuli AbhinavTuli changed the title [Bug Fix] Stop accessing underlying storage for checking encoder existance [Bug Fix] Stop accessing underlying storage for checking encoder existence Dec 28, 2021
@codecov
Copy link

codecov bot commented Dec 28, 2021

Codecov Report

Merging #1417 (924aafc) into main (5662c3a) will decrease coverage by 0.08%.
The diff coverage is 77.08%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1417      +/-   ##
==========================================
- Coverage   92.33%   92.24%   -0.09%     
==========================================
  Files         176      176              
  Lines       14204    14227      +23     
==========================================
+ Hits        13115    13124       +9     
- Misses       1089     1103      +14     
Flag Coverage Δ
unittests 92.24% <77.08%> (-0.09%) ⬇️

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

Impacted Files Coverage Δ
hub/core/chunk_engine.py 95.22% <77.08%> (-1.46%) ⬇️
hub/core/storage/s3.py 71.91% <0.00%> (-1.69%) ⬇️
hub/core/lock.py 83.60% <0.00%> (-1.64%) ⬇️

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 5662c3a...924aafc. Read the comment docs.

try:
self.meta_cache[key] = enc
except ReadOnlyModeError:
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

If tile encoder does not exist and the storage is in read only mode, I am not sure we should be setting / returning an empty encoder that is not persistent. Should probably return None (and the calling method should check for None).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

checking for None won't work as that is the default value. To prevent multiple reads from storage we're checking self._tile_encoder to not be None. Persistence shouldn't be an issue as this only happens for read only.
If the user switches mode and tries to write, we will synchronize when the user does his first write in add_cachables_to_cache_dirty_keys

@AbhinavTuli AbhinavTuli merged commit fee5178 into main Dec 30, 2021
@AbhinavTuli AbhinavTuli deleted the fix/tile_encoder_exist_check branch December 30, 2021 07:18
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