Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: prevent flushing when we are updating data. #243

Merged
merged 1 commit into from
Dec 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion plottr/data/datadict_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ def write_data_to_file(datadict: DataDict,
raise RuntimeError('Group does not exist, initialize file first.')
grp = f[groupname]

# TODO: this should become a more robust solution.
# should prevent writing anything in non-swmr mode when there's danger
# that another process is reading.
# also should detect if we can currently write anything.
# if we want to use swmr, we need to make sure that we're not
# creating any more objects (see hdf5 docs).
allexist = True
Expand All @@ -208,7 +212,6 @@ def write_data_to_file(datadict: DataDict,
for k, v in datadict.meta_items(clean_keys=False):
set_attr(grp, k, v)

f.flush()
if allexist and swmr_mode and not f.swmr_mode:
f.swmr_mode = True

Expand Down