Commit 7bd59f21 authored by Lei Wang's avatar Lei Wang Committed by LeiWang1999
Browse files

[Refactor] Update cache key generation in KernelCache (#283)

- Changed the cache key generation to use the serialized script of the function instead of the function object itself, improving the uniqueness of cache keys.
parent 541e1685
...@@ -51,7 +51,7 @@ class KernelCache: ...@@ -51,7 +51,7 @@ class KernelCache:
""" """
Generates a unique cache key. Generates a unique cache key.
""" """
func_binary = cloudpickle.dumps(func) func_binary = cloudpickle.dumps(func.script())
key_data = { key_data = {
"func": sha256(func_binary).hexdigest(), # Use SHA256 to generate hash key "func": sha256(func_binary).hexdigest(), # Use SHA256 to generate hash key
"out_idx": tuple(out_idx) if isinstance(out_idx, (list, tuple)) else [out_idx], "out_idx": tuple(out_idx) if isinstance(out_idx, (list, tuple)) else [out_idx],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment