Closed isacdaavid closed 2 years ago
"although that doesn't explain why I'm only seeing the error until now"
Now I see the function was moved from utils.py
to conf.py
Indeed writing directly to the file is not atomic enough. It may not be complete when another process tries to read from it, and if other processes try to write to it concurrently, there can be contention for the file lock. I can look into other options.
I encountered this new thing while trying to run the test suite against the iit-4.0 branch, while also excluding the tests I had already found to be anti-sufficient for passing the suite.
It fails to collect
test/test_subsystem_phi_max.py
before actual testing starts.According to the internet,
os.rename()
can't move files across filesystems, which is the case in my computer (although that doesn't explain why I'm only seeing the error until now):People suggest doing it in 2 steps: copying, removing. I simply bypassed this by making
atomic_write_yaml()
write directly to the final path, but I don't know if either solution is "atomic" enough.