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

Stable local cache keys even in the case of nested dictionaries #1231

Merged
merged 1 commit into from
Oct 13, 2022

Conversation

eapolinario
Copy link
Collaborator

Signed-off-by: Eduardo Apolinario [email protected]

TL;DR

Generate local cache keys by using protobuf's stable representation + joblib hashing

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

In #1126 we started using joblib and a custom Hasher to produce cache keys. That change handled the case of top-level dictionaries, but not nested dictionaries.

This PR takes a different approach. We leverage the stable representation produced by the protobuf library and use that string as input (instead of a more complex object) as an input to joblib.hash (which generates fixed-length strings).

Tracking Issue

flyteorg/flyte#2924

Follow-up issue

NA
OR
https://github.com/flyteorg/flyte/issues/

@codecov
Copy link

codecov bot commented Oct 10, 2022

Codecov Report

Merging #1231 (937db60) into master (9b8f255) will increase coverage by 0.01%.
The diff coverage is 91.66%.

@@            Coverage Diff             @@
##           master    #1231      +/-   ##
==========================================
+ Coverage   68.64%   68.66%   +0.01%     
==========================================
  Files         288      288              
  Lines       26301    26303       +2     
  Branches     2937     2936       -1     
==========================================
+ Hits        18055    18060       +5     
+ Misses       7767     7764       -3     
  Partials      479      479              
Impacted Files Coverage Δ
flytekit/core/local_cache.py 46.66% <66.66%> (-0.40%) ⬇️
tests/flytekit/unit/core/test_local_cache.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@eapolinario eapolinario merged commit 36dd82b into master Oct 13, 2022
VPraharsha03 pushed a commit to VPraharsha03/flytekit that referenced this pull request Oct 29, 2022
Signed-off-by: Eduardo Apolinario <[email protected]>

Signed-off-by: Eduardo Apolinario <[email protected]>
Co-authored-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Vivek Praharsha <[email protected]>
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.

2 participants