Use strict index hash for caching - #204
Conversation
Reviewer's GuideSwitches cache key generation for process_index to use a strict audformat index hash and adds regression coverage to ensure index ordering and cache reuse behave correctly when processing indices in different orders. Sequence diagram for process_index caching with strict index hashsequenceDiagram
participant Caller
participant process_index
participant audformat_utils as audformat.utils
participant CacheFile
Caller->>process_index: process_index(index, cache_root)
alt cache_root is not None
process_index->>audformat_utils: hash(index, strict=True)
audformat_utils-->>process_index: hash
process_index->>CacheFile: check os.path.exists(cache_path)
alt cache file exists
process_index->>CacheFile: load cached result
CacheFile-->>process_index: cached result
else cache file missing
process_index->>process_index: compute result
process_index->>CacheFile: save result
end
else cache_root is None
process_index->>process_index: compute result without cache
end
process_index-->>Caller: result
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
🚀 New features to boost your workflow:
|
|
Unfortunately, audinterface/audinterface/core/feature.py Line 548 in 8264e46 There you have to change it as well and add an extra test for |
Thanks, that would have been bad to miss! I now added a test and change for |
Closes #203
Switch to using
audformat.utils.hash(index, strict=True)for storing process results in a cache file.This also adds a test that checks whether the returned index is as expected when the same index but with different order has already been cached.