broadinstitute / CellBender

CellBender is a software package for eliminating technical artifacts from high-throughput single-cell RNA sequencing (scRNA-seq) data.
https://cellbender.rtfd.io
BSD 3-Clause "New" or "Revised" License
285 stars 52 forks source link

os.replace() instead of os.rename() to save checkpoint #253

Closed sjfleming closed 1 year ago

sjfleming commented 1 year ago

Closes #250

I did not realize this, but os.rename() will error in Windows if the destination file already exists.

os.replace() is the correct replacement.

Notes: This is intended to be an atomic operation to move the temporary checkpoint file to its final location. We need the final checkpoint file to be complete at all times -- otherwise, another process trying to access the checkpoint file (like Cromwell copying for instance) could encounter a half-written checkpoint file, and we would set up a race condition.

sjfleming commented 1 year ago

Merged into #259