Fix caching bug on ee.List.shuffle(seed=False) #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As explained in #6,
ee.List.shuffle(seed=False)
is non-deterministic and therefore returns different results from the same serialized object. This is (arguably) an underlying issue in the Earth Engine API. To prevent incorrect cache hits that would display the same data for differently shuffled lists (and objects built from shuffled lists), this PR adds a check against the serialized object. Ifee.List.shuffle(seed=False)
was used to construct the object, a randomized_eerepr_id
attr is added to the object, causing equality checks (ee.ComputedObject.__eq__
) to fail and the cache to miss.To accomplish that, we had to slightly change the repr setup by wrapping the cached repr generation function
_repr_html_
in an uncached_ee_repr
function where the deterministic check takes place.Close #6