f3dasm
f3dasm copied to clipboard
pd.EmptyData error in concurrent access `from_file` and `store` method
The Problem
While one process invokes the store() method and another process tries to read the ExperimentData object (from_file()), there is the possibility that when the _Data object invokes the to_csv method, the object is read from disk.
Because the to_csv method first empties the files and then reads to it, the file can be read empty. This creates an pd.EmptyDataError. Especially when a large number of experiments need to be written.
Possible solution
Work with temporary file creation:
store()
-
to_csvto.tmpfile - Rename the file to
.csv - Remove the `.tmp file
from_file()
- Check for
.tmpfiles in path. If exists, retry later - If no `.tmp files, open like normally