Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion python/triton/runtime/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,15 @@ def put(self, data, filename, binary=True) -> str:
f.write(data)
# Replace is guaranteed to be atomic on POSIX systems if it succeeds
# so filepath cannot see a partial write
os.replace(temp_path, filepath)
try:
os.replace(temp_path, filepath)
except PermissionError:
# Ignore PermissionError on Windows because it happens when another process already
# put a file into the cache and locked it by opening it.
if os.name == "nt":
os.remove(temp_path)
else:
raise
os.removedirs(temp_dir)
return filepath

Expand Down