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

Fix caching bug on ee.List.shuffle(seed=False) #7

Merged
merged 1 commit into from
Nov 9, 2022
Merged

Conversation

aazuspan
Copy link
Owner

@aazuspan aazuspan commented Nov 9, 2022

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. If ee.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

@aazuspan aazuspan added the bug Something isn't working label Nov 9, 2022
@aazuspan aazuspan merged commit 3e748b7 into main Nov 9, 2022
@aazuspan aazuspan deleted the shuffled-list branch December 1, 2022 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix ee.List.shuffle
1 participant