Skip to content

Commit

Permalink
FIX: Retry renaming pkl(z) files on fail
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Nov 2, 2021
1 parent eab4b2a commit 6230371
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion nipype/utils/filemanip.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,15 @@ def savepkl(filename, record, versioning=False):
tmpfile = filename + ".tmp"
with pkl_open(tmpfile, "wb") as pkl_file:
pkl_file.write(content)
os.rename(tmpfile, filename)
for _ in range(5):
try:
os.rename(tmpfile, filename)
break
except FileNotFoundError as e:
fmlogger.debug(str(e))
sleep(2)
else:
raise e


rst_levels = ["=", "-", "~", "+"]
Expand Down

0 comments on commit 6230371

Please sign in to comment.