diff --git a/dvc/rwlock.py b/dvc/rwlock.py index bad2df9495..d0665483c3 100644 --- a/dvc/rwlock.py +++ b/dvc/rwlock.py @@ -50,6 +50,9 @@ def _edit_rwlock(lock_dir): yield lock with open(path, "w+") as fobj: json.dump(lock, fobj) + # NOTE: flush and fsync to ensure that rwlock contents are saved + fobj.flush() + os.fsync(fobj.fileno()) def _infos_to_str(infos):