From 531ed1566d8c4644b30445f32996617f37fee246 Mon Sep 17 00:00:00 2001 From: Ayush Ojha Date: Sat, 31 Jan 2026 00:52:52 -0800 Subject: [PATCH] Fix missing freq parameter in cache update writer locks Pass freq to C.dpm.get_data_uri() in DiskExpressionCache.update() and DiskDatasetCache.update() to avoid KeyError when non-default frequencies are configured. Fixes #2012 --- qlib/data/cache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qlib/data/cache.py b/qlib/data/cache.py index fbf6e839db..0390d4b4a8 100644 --- a/qlib/data/cache.py +++ b/qlib/data/cache.py @@ -591,7 +591,7 @@ def update(self, sid, cache_uri, freq: str = "day"): self.clear_cache(cp_cache_uri) return 2 - with CacheUtils.writer_lock(self.r, f"{str(C.dpm.get_data_uri())}:expression-{cache_uri}"): + with CacheUtils.writer_lock(self.r, f"{str(C.dpm.get_data_uri(freq))}:expression-{cache_uri}"): with meta_path.open("rb") as f: d = restricted_pickle_load(f) instrument = d["info"]["instrument"] @@ -958,7 +958,7 @@ def update(self, cache_uri, freq: str = "day"): return 2 im = DiskDatasetCache.IndexManager(cp_cache_uri) - with CacheUtils.writer_lock(self.r, f"{str(C.dpm.get_data_uri())}:dataset-{cache_uri}"): + with CacheUtils.writer_lock(self.r, f"{str(C.dpm.get_data_uri(freq))}:dataset-{cache_uri}"): with meta_path.open("rb") as f: d = restricted_pickle_load(f) instruments = d["info"]["instruments"]