Open
Conversation
3 tasks
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.
This PR introduces a caching system to the
ModuleIOinterface to hold values that should not be re-calculated across modules.In this first implementation I only added an
RMSDkey but this can be further expanded to hold anything.It works by adding a
Cacheto theModuleIOinterface that has full serialization support. It has a_storeto hold the information and a_indexas a helper for faster O(1) lookup (standard caching implementation).Being part of the
ModuleIOinterface means it is accessible to all modules and save/load operations in this interface also applies toCache.I have added a new method
update_cacheto the interface that is used by the primitive module class to propagate the cache when the moduleexport_io_models.A relevant technical detail is that for proper typing and serializadion/de-serialization of the
Cachewe need to drop thejsonpickleapproach to represent theModuleIOinterface in favor of a simple (but not human readable) pickle. I also observed that a lot of tests are using a file representation of this interface as arguments to test some behaviour - so I have added a fallback to theloadmethod to handle this scenario. This is not ideal but its a sensible compromise.No modules are using the cache yet!
This PR here just adds the system, I will refactor the modules to use the cache in another PR (related to #1530 and #1525)