Clear internal caches when re-creating from same SMIRNOFF objects#1456
Open
mattwthompson wants to merge 4 commits intomainfrom
Open
Clear internal caches when re-creating from same SMIRNOFF objects#1456mattwthompson wants to merge 4 commits intomainfrom
mattwthompson wants to merge 4 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1456 +/- ##
==========================================
- Coverage 93.97% 93.96% -0.01%
==========================================
Files 73 73
Lines 6340 6334 -6
==========================================
- Hits 5958 5952 -6
Misses 382 382 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Another possible fix for #1453, including the test @j-wags added
A problem with the
_clear_cachefunction introduced in #1435 is that it went through all objects visible to the garbage collector (!) and only interacted with objects that are themselves internal to theopenff.interchangenamespace. This is casting a net that is awfully wide and unnecessary since we already know what caches we want to clear. Since the crux of the bad behavior can be traced to two internal functions (see here for a good example) we don't need to iterate so widely.Put another way: the problematic cached functions1 are only two in number and inside of Interchange. We can just clear those specific function caches directly when we need to.
Checklist
Footnotes
and they do nothing but look up parameters inside of
ParameterHandlers, see https://github.com/openforcefield/openff-toolkit/issues/2065 ↩