h5py supports the native S3 driver for HDF5 (the ros3 driver). We've enabled this with a local build of HDF5.
>>> import h5py
>>>
>>> print(f'Registered drivers: {h5py.registered_drivers()}')
Registered drivers: frozenset({ 'ros3', 'sec2', 'fileobj', 'core', 'family', 'split', 'stdio', 'mpio'})
We have a custom endpoint for our S3 service (not AWS). We run a Ceph/S3 service.
Is there a way to specify the S3 endpoint?
The documentation here makes no mention of it.
If we attempt to run the following we get a generic error that we presume has to do with the obvious missing endpoint.
>>> h5py.File(
f,
driver='ros3',
aws_region=bytes('unused', 'utf-8'), # unused by our S3 but required
secret_id=bytes(access_key, 'utf-8'),
secret_key=bytes(secret_key, 'utf-8')
)
Traceback (most recent call last):
File "mycode.py", line 32, in <module>
with h5py.File(f, driver='ros3', aws_region=b'west', secret_id=access_key, secret_key=secret_key) as fh5:
File "opt/anaconda3/envs/smart_open_env/lib/python3.9/site-packages/h5py/_hl/files.py", line 567, in __init__
fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
File "opt/anaconda3/envs/smart_open_env/lib/python3.9/site-packages/h5py/_hl/files.py", line 231, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 106, in h5py.h5f.open
OSError: Unable to open file (curl cannot perform request)
I checked that the commonly used environment variables ENDPOINT and ENDPOINT_URL were set, but had no effect.
from Custom endpoint for `ros3` driver in `h5py`
No comments:
Post a Comment