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

Simultaneous write/read access to h5 files #58

Merged
merged 5 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions pyEvalData/io/palxfel.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def parse_raw(self):
self.file_name.format(scan_number) + '.h5')

try:
os.environ["HDF5_USE_FILE_LOCKING"] = "FALSE"
with h5py.File(h5_file, 'r') as h5:
header = h5['R{0:04d}/header'.format(scan_number)]

Expand Down Expand Up @@ -171,6 +172,7 @@ def read_raw_scan_data(self, scan):
self.file_name.format(scan.number),
self.file_name.format(scan.number) + '.h5')

os.environ["HDF5_USE_FILE_LOCKING"] = "FALSE"
with h5py.File(h5_file, 'r') as h5:
entry = h5['R{0:04d}'.format(scan.number)]
# iterate through data fields
Expand Down
8 changes: 5 additions & 3 deletions pyEvalData/io/sardana_nexus.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

from numpy.core.records import fromarrays
import nexusformat.nexus as nxs
import os.path as path
import os

from .source import Source
from .scan import Scan
Expand Down Expand Up @@ -95,8 +95,9 @@ def parse_raw(self):

"""
self.log.info('parse_raw')
nxs_file_path = path.join(self.file_path, self.file_name)
nxs_file_path = os.path.join(self.file_path, self.file_name)
try:
os.environ["HDF5_USE_FILE_LOCKING"] = "FALSE"
nxs_file = nxs.nxload(nxs_file_path, mode='r')
except nxs.NeXusError:
raise nxs.NeXusError('Sardana NeXus file \'{:s}\' does not exist!'.format(
Expand Down Expand Up @@ -144,8 +145,9 @@ def read_raw_scan_data(self, scan):
"""
self.log.info('read_raw_scan_data for scan #{:d}'.format(scan.number))
# try to open the file
nxs_file_path = path.join(self.file_path, self.file_name)
nxs_file_path = os.path.join(self.file_path, self.file_name)
try:
os.environ["HDF5_USE_FILE_LOCKING"] = "FALSE"
nxs_file = nxs.nxload(nxs_file_path, mode='r')
except nxs.NeXusError:
raise nxs.NeXusError('Sardana NeXus file \'{:s}\' does not exist!'.format(
Expand Down
Loading