f3dasm icon indicating copy to clipboard operation
f3dasm copied to clipboard

pd.EmptyData error in concurrent access `from_file` and `store` method

Open mpvanderschelling opened this issue 1 year ago • 0 comments

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()

  1. to_csv to .tmp file
  2. Rename the file to .csv
  3. Remove the `.tmp file

from_file()

  1. Check for .tmp files in path. If exists, retry later
  2. If no `.tmp files, open like normally

mpvanderschelling avatar Jun 26 '24 09:06 mpvanderschelling