-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Add option to pickler dumps() for best-effort determinism #34698
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
Conversation
The motivation for this change is Flume caches pickled code and non-determinism breaks the caching. While making pickling fully-determinism is infeasible, increasing the determinism is still useful due to the increase in cache hits. Sets are a common source of non-determinism. This change sorts set elements to provide deterministic serialization. Because not all types provide a comparison operator, the sorting routine implements generic element comparison logic. See: apache#34410
Assigning reviewers. If you would like to opt out of this review, comment R: @tvalentyn for label python. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
cc: @claudevdm |
The FlumeRunner will enable this feature flag via its canary mechansim. The option is localized to only serialization of transforms because that is what the FlumeRunner wants to cache. It will not enable best-effort deterministic serialization for other uses of pickling.
rerunning tests |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #34698 +/- ##
============================================
+ Coverage 54.61% 54.63% +0.02%
Complexity 1480 1480
============================================
Files 1008 1010 +2
Lines 159767 159960 +193
Branches 1079 1079
============================================
+ Hits 87262 87402 +140
- Misses 70403 70456 +53
Partials 2102 2102
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The motivation for this change is Flume caches pickled code and non-determinism breaks the caching. While making pickling fully-determinism is infeasible, increasing the determinism is still useful due to the increase in cache hits. Sets are a common source of non-determinism. This change sorts set elements to provide deterministic serialization. Because not all types provide a comparison operator, the sorting routine implements generic element comparison logic.
See: #34410