MCPcopy Index your code
hub / github.com/microsoft/qlib / visit

Method visit

qlib/data/cache.py:222–237  ·  view source on GitHub ↗
(cache_path: Union[str, Path])

Source from the content-addressed store, hash-verified

220
221 @staticmethod
222 def visit(cache_path: Union[str, Path]):
223 # FIXME: Because read_lock was canceled when reading the cache, multiple processes may have read and write exceptions here
224 try:
225 cache_path = Path(cache_path)
226 meta_path = cache_path.with_suffix(".meta")
227 with meta_path.open("rb") as f:
228 d = pickle.load(f)
229 with meta_path.open("wb") as f:
230 try:
231 d["meta"]["last_visit"] = str(time.time())
232 d["meta"]["visits"] = d["meta"]["visits"] + 1
233 except KeyError as key_e:
234 raise KeyError("Unknown meta keyword") from key_e
235 pickle.dump(d, f, protocol=C.dump_protocol_version)
236 except Exception as e:
237 get_module_logger("CacheUtils").warning(f"visit {cache_path} cache error: {e}")
238
239 @staticmethod
240 def acquire(lock, lock_name):

Callers 3

_expressionMethod · 0.80
_datasetMethod · 0.80
_dataset_uriMethod · 0.80

Calls 2

loadMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected