Closed
Description
There is a KeyError
at xarray.backends.file_manager.CachingFileManager
for the acquire
method on these lines:
with self._lock:
try:
file = self._cache[self._key]
which does not happen when I test on my macos.
Let me know if you require further testing on my part.
Full log:
=================================== FAILURES ===================================
________________________________ test_qtl_xarr _________________________________
self = <xarray.backends.file_manager.CachingFileManager object at 0x7f59e2cab978>
def acquire(self):
"""Acquiring a file object from the manager.
A new file is only opened if it has expired from the
least-recently-used cache.
This method uses a reentrant lock, which ensures that it is
thread-safe. You can safely acquire a file in multiple threads at the
same time, as long as the underlying file object is thread-safe.
Returns
-------
An open file object, as returned by ``opener(*args, **kwargs)``.
"""
with self._lock:
try:
> file = self._cache[self._key]
miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/file_manager.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.backends.lru_cache.LRUCache object at 0x7f5a04a9c630>
key = [<function _open_netcdf4_group at 0x7f5a04abc1e0>, ('/tmp/tmprj8lwlat/xarr.hdf5', CombinedLock([<SerializableLock: 447...>])), 'r', (('clobber', True), ('diskless', False), ('format', 'NETCDF4'), ('group', '/foo/chr1'), ('persist', False))]
def __getitem__(self, key):
# record recent use of the key by moving it to the front of the list
with self._lock:
> value = self._cache[key]
E KeyError: [<function _open_netcdf4_group at 0x7f5a04abc1e0>, ('/tmp/tmprj8lwlat/xarr.hdf5', CombinedLock([<SerializableLock: 4471090f-419e-49bd-9d27-4156e09febdd>, <SerializableLock: b9eb5ba1-2830-402e-b48f-3ef45768b7c2>])), 'r', (('clobber', True), ('diskless', False), ('format', 'NETCDF4'), ('group', '/foo/chr1'), ('persist', False))]
miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/lru_cache.py:43: KeyError
During handling of the above exception, another exception occurred:
def test_qtl_xarr():
with limix.example.file_example("xarr.hdf5.bz2") as filepath:
filepath = limix.sh.extract(filepath, verbose=False)
sample_ids = limix.io.hdf5.fetch(filepath, "/foo/chr1/col_header/sample_ids")
rsid = dict()
for i in range(1, 3):
rsid[i] = limix.io.hdf5.fetch(
filepath, "/foo/chr{}/row_header/rsid".format(i)
)
G = []
for i in range(1, 3):
> g = xr.open_dataset(filepath, "/foo/chr{}".format(i))["matrix"]
miniconda/envs/test-environment/lib/python3.6/site-packages/limix/qtl/test/test_qtl_xarr.py:20:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/api.py:320: in open_dataset
filename_or_obj, group=group, lock=lock, **backend_kwargs)
miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/netCDF4_.py:355: in open
return cls(manager, lock=lock, autoclose=autoclose)
miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/netCDF4_.py:314: in __init__
self.format = self.ds.data_model
miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/netCDF4_.py:359: in ds
return self._manager.acquire().value
miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/file_manager.py:143: in acquire
file = self._opener(*self._args, **kwargs)
miniconda/envs/test-environment/lib/python3.6/site-packages/xarray/backends/netCDF4_.py:247: in _open_netcdf4_group
ds = nc4.Dataset(filename, mode=mode, **kwargs)
netCDF4/_netCDF4.pyx:2135: in netCDF4._netCDF4.Dataset.__init__
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E OSError: [Errno -101] NetCDF: HDF error: b'/tmp/tmprj8lwlat/xarr.hdf5'
netCDF4/_netCDF4.pyx:1752: OSError
===================== 1 failed, 50 passed in 65.82 seconds =====================
The command "bash <(curl -fsSL https://raw.githubusercontent.com/horta/ci/master/travis.sh)" exited with 1.
Done. Your build exited with 1.
Metadata
Metadata
Assignees
Labels
No labels