Uh oh!
There was an error while loading. Please reload this page.
ensure atomic writes when saving a file - #200
Conversation
fc9ba2f to
187e064Compare2b06b62 to
82a300bCompareMaybe adding a |
Uh oh!
There was an error while loading. Please reload this page.
akhmerov
commented
Jun 20, 2019
Maybe that is also worth investigating as a separate issue? Saving usually shouldn't cause a problem if adaptive is stable. |
akhmerov
commented
Jun 20, 2019
The implementation is rather fragile and potentially hitting bad corner cases (overwriting a different file, times being messed up, etc); I think there should be a more systematic way to do an atomic write. |
basnijholt
commented
Jun 20, 2019
The reason for the crash is not Adaptive, but merely low priority nodes that can be evicted at any time, that suddenly stop. |
basnijholt
commented
Jun 20, 2019
Do you have a suggestion? |
akhmerov
commented
Jun 20, 2019
https://github.com/untitaker/python-atomicwrites seems like an option or any other alternatives. Or we could use all the relevant tricks from it. |
akhmerov
commented
Jun 20, 2019
I also have to bring up another approach: we provide a way to get an in-memory data in adaptive and the user uses |
9a45665 to
015c436Comparebasnijholt
commented
Jun 20, 2019
There is already I do not mind to add the dependency, it's used by 19723 other packages and it is tiny. See the commit I've made. Also, I don't see a reason why people wouldn't want a 'safe' save. |
2115f48 to
0cc2fc7CompareRight now, if a program crashes in the middle of saving, you lose all your data. Right now, if a program crashes in the middle of saving, you lose all your data. This ensures that the old file is first moved, then the new file is saved, and only then the old file is removed.
Right now, if a program crashes in the middle of saving, you lose all your data. This ensures that the old file is first moved, then the new file is saved, and only then the old file is removed.
This is not a hypothetical scenario but happens every day for some people that I work with ATM.