Closed jcrist closed 9 years ago
I really want to get rid of automatic temp files for castra, as having them complicates option 1 as well. Tempfiles/directories can be created by a separate contextmanager, and simplify the implementation of castra. I need this to be settled to fix https://github.com/blaze/dask/pull/644, so would like a group decision quickly. Ping @mrocklin , @esc, @cpcloud for thoughts.
I added a readonly
kwarg in #45. If we decide we want more fine-grained open modes (like hdf5 has 'a', 'w', 'r+'...) this can be switched out later. I still would like to get rid of the tempfile functionality, but this PR covers my immediate need.
The
__del__
method causes a race condition between processes/threads reading from the same castra if it's initialized multiple times (differentCastra
objects, same filepath). Other workers can read from the file midflush
, which causes periodic failures (seen both locally, and on travis here).A few solutions:
readonly
mode that doesn't do anything on__del__
, and doesn't allowextend
/extend_sequence
. Could either be amode='r'
kwarg, or areadonly=True
kwarg. Default would be writable, so no change in default behavior.flush
as a default is worth it, but I'm definitely against automatic delete. IMO temporary files/directories should be managed externally to castra. This is a separate issue entirely though.My preference is option 1.