[HiCache] Keep the file backend temp file name within NAME_MAX (#38925)
This commit is contained in:
@@ -533,10 +533,7 @@ class HiCacheFile(HiCacheStorage):
|
|||||||
return False
|
return False
|
||||||
reserved = True
|
reserved = True
|
||||||
|
|
||||||
tmp_path = (
|
tmp_path = os.path.join(self.file_path, f".{uuid.uuid4().hex}.tmp")
|
||||||
f"{tensor_path}.tmp."
|
|
||||||
f"{os.getpid()}.{threading.get_ident()}.{uuid.uuid4().hex}"
|
|
||||||
)
|
|
||||||
value.contiguous().view(dtype=torch.uint8).numpy().tofile(tmp_path)
|
value.contiguous().view(dtype=torch.uint8).numpy().tofile(tmp_path)
|
||||||
os.replace(tmp_path, tensor_path)
|
os.replace(tmp_path, tensor_path)
|
||||||
self._evictor.commit(suffixed)
|
self._evictor.commit(suffixed)
|
||||||
|
|||||||
Reference in New Issue
Block a user