Skip to content

add caching to ModuleIO interface#1529

Open
rvhonorato wants to merge 12 commits intomainfrom
1528-add-caching-to-store-rmsd-values
Open

add caching to ModuleIO interface#1529
rvhonorato wants to merge 12 commits intomainfrom
1528-add-caching-to-store-rmsd-values

Conversation

@rvhonorato
Copy link
Copy Markdown
Member

@rvhonorato rvhonorato commented Apr 21, 2026

This PR introduces a caching system to the ModuleIO interface to hold values that should not be re-calculated across modules.

In this first implementation I only added an RMSD key but this can be further expanded to hold anything.

It works by adding a Cache to the ModuleIO interface that has full serialization support. It has a _store to hold the information and a _index as a helper for faster O(1) lookup (standard caching implementation).

Being part of the ModuleIO interface means it is accessible to all modules and save/load operations in this interface also applies to Cache.

I have added a new method update_cache to the interface that is used by the primitive module class to propagate the cache when the module export_io_models.

A relevant technical detail is that for proper typing and serializadion/de-serialization of the Cache we need to drop the jsonpickle approach to represent the ModuleIO interface 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 the load method 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)

@rvhonorato rvhonorato linked an issue Apr 21, 2026 that may be closed by this pull request
@rvhonorato rvhonorato self-assigned this Apr 21, 2026
@rvhonorato rvhonorato added enhancement Improving something in the codebase feature Adding something new to the codebase and removed enhancement Improving something in the codebase labels Apr 21, 2026
@rvhonorato rvhonorato marked this pull request as ready for review April 21, 2026 15:04
@rvhonorato rvhonorato enabled auto-merge April 21, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Adding something new to the codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add caching to store RMSD values

1 participant