ewoksdata 2.0.1__tar.gz → 2.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {ewoksdata-2.0.1/src/ewoksdata.egg-info → ewoksdata-2.0.2}/PKG-INFO +1 -1
  2. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/pyproject.toml +1 -1
  3. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/data/bliss.py +27 -3
  4. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/tests/test_data_bliss.py +2 -2
  5. {ewoksdata-2.0.1 → ewoksdata-2.0.2/src/ewoksdata.egg-info}/PKG-INFO +1 -1
  6. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/LICENSE.md +0 -0
  7. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/README.md +0 -0
  8. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/setup.cfg +0 -0
  9. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/__init__.py +0 -0
  10. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/data/__init__.py +0 -0
  11. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/data/blissdata/__init__.py +0 -0
  12. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/data/blissdata/blissdatav0.py +0 -0
  13. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/data/blissdata/blissdatav1.py +0 -0
  14. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/data/blissdata/blissdatav2.py +0 -0
  15. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/data/contextiterator.py +0 -0
  16. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/data/hdf5/__init__.py +0 -0
  17. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/data/hdf5/config.py +0 -0
  18. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/data/hdf5/dataset_writer.py +0 -0
  19. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/data/hdf5/types.py +0 -0
  20. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/data/nexus.py +0 -0
  21. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/data/url.py +0 -0
  22. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/data/utils.py +0 -0
  23. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/tests/__init__.py +0 -0
  24. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/tests/conftest.py +0 -0
  25. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/tests/data/__init__.py +0 -0
  26. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/tests/data/bliss_scans.py +0 -0
  27. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/tests/test_contextiterator.py +0 -0
  28. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/tests/test_data_hdf5.py +0 -0
  29. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/tests/test_data_nexus.py +0 -0
  30. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata/tests/test_dataset_writer.py +0 -0
  31. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata.egg-info/SOURCES.txt +0 -0
  32. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata.egg-info/dependency_links.txt +0 -0
  33. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata.egg-info/requires.txt +0 -0
  34. {ewoksdata-2.0.1 → ewoksdata-2.0.2}/src/ewoksdata.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ewoksdata
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: Ewoks tasks for data access
5
5
  Author-email: ESRF <dau-pydev@esrf.fr>
6
6
  License: # MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ewoksdata"
7
- version = "2.0.1"
7
+ version = "2.0.2"
8
8
  authors = [{ name = "ESRF", email = "dau-pydev@esrf.fr" }]
9
9
  description = "Ewoks tasks for data access"
10
10
  readme = { file = "README.md", content-type = "text/markdown" }
@@ -3,7 +3,9 @@ or from memory (Redis or device servers).
3
3
  """
4
4
 
5
5
  import logging
6
+ import os
6
7
  import sys
8
+ import time
7
9
  from numbers import Integral
8
10
  from numbers import Number
9
11
  from typing import Any
@@ -52,6 +54,8 @@ def get_data(
52
54
  data_url = url.as_dataurl(data)
53
55
  filename, h5path, idx = url.h5dataset_url_parse(data_url)
54
56
 
57
+ _wait_for_file(filename, **hdf5_options)
58
+
55
59
  if h5py.is_hdf5(filename):
56
60
  return _get_hdf5_data(filename, h5path, idx=idx, **hdf5_options)
57
61
 
@@ -73,16 +77,36 @@ def get_data(
73
77
  raise TypeError(f"Unsupported data type: {type(data)!r}")
74
78
 
75
79
 
80
+ def _wait_for_file(
81
+ filename: str,
82
+ retry_timeout: Optional[float] = None,
83
+ retry_period: Optional[float] = None,
84
+ **_,
85
+ ) -> None:
86
+ if retry_period is None:
87
+ retry_period = 0.1
88
+ t0 = time.time()
89
+ while True:
90
+ if os.path.exists(filename):
91
+ return
92
+ if retry_timeout is not None:
93
+ if (time.time() - t0) > retry_timeout:
94
+ raise TimeoutError(
95
+ f"File {filename} is not created within {retry_timeout} sec"
96
+ )
97
+ time.sleep(retry_period)
98
+
99
+
76
100
  def get_image(
77
101
  data: Union[str, DataUrl, ArrayLike, Number], **hdf5_options: Any
78
102
  ) -> numpy.ndarray:
79
103
  """
80
104
  Return a NumPy array or a scalar from *data*.
81
105
 
106
+ Retry options, such as `retry_timeout` and `retry_period` are forwarded to the internal HDF5 data reader.
107
+
82
108
  :param data: Either a data-URL, an array-like object or a scalar number.
83
- :param retry_timeout: Timeout for the retry mechanism.
84
- :param retry_period: Interval between retries.
85
- :param **hdf5_options: Additional options forwarded to :class:`silx.io.h5py_utils.File`.
109
+ :param hdf5_options: Additional options forwarded to :class:`silx.io.h5py_utils.File`.
86
110
  :return: A 2-D image.
87
111
  """
88
112
  data = get_data(data, **hdf5_options)
@@ -28,8 +28,8 @@ def test_get_data_hdf5(tmpdir):
28
28
  numpy.testing.assert_array_equal(img1, img3)
29
29
 
30
30
  filename_non_existing = str(tmpdir / "data_non_existing.h5")
31
- with pytest.raises(IOError):
32
- _ = bliss.get_data(f"{filename_non_existing}?path=/img")
31
+ with pytest.raises(TimeoutError):
32
+ _ = bliss.get_data(f"{filename_non_existing}?path=/img", retry_timeout=0)
33
33
 
34
34
 
35
35
  @pytest.mark.parametrize("lima_names", [(), ("p3",), ("p3", "p4")])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ewoksdata
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: Ewoks tasks for data access
5
5
  Author-email: ESRF <dau-pydev@esrf.fr>
6
6
  License: # MIT License
File without changes
File without changes
File without changes