Add CacheDict.filepath and observe_access - #314
Open
teonbrooks wants to merge 1 commit into
Open
teonbrooks wants to merge 1 commit into
teonbrooks wants to merge 1 commit into
Conversation
- CacheDict.filepath(key): public accessor returning the absolute on-disk path backing a key (parquet/npy/pickle dumps, directory entries), where indexing returns the loaded value instead. - observe_access(callback): context manager notified with the folder of every CacheDict constructed or accessed within its scope. Thread-safe; observer errors are caught and logged rather than propagated. Adds unit tests for both.
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.
While working on our internal reporting tool, I've needed to patch these two features. They seem useful to upstream.
The first is to return the filepath from the cache so that it can be used to load parquets, etc.
The second is to build a graph of files used for the report. This allows us to export to minimally export a s3 bucket and it lets us do some treeshaking to remove cache files no longer needed for the reports.
Adds unit tests for both.