maxframe 0.1.0b5__cp39-cp39-win32.whl → 1.0.0__cp39-cp39-win32.whl

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.

Potentially problematic release.


This version of maxframe might be problematic. Click here for more details.

Files changed (203) hide show
  1. maxframe/_utils.cp39-win32.pyd +0 -0
  2. maxframe/codegen.py +10 -4
  3. maxframe/config/config.py +68 -10
  4. maxframe/config/validators.py +42 -11
  5. maxframe/conftest.py +58 -14
  6. maxframe/core/__init__.py +2 -16
  7. maxframe/core/entity/__init__.py +1 -12
  8. maxframe/core/entity/executable.py +1 -1
  9. maxframe/core/entity/objects.py +46 -45
  10. maxframe/core/entity/output_types.py +0 -3
  11. maxframe/core/entity/tests/test_objects.py +43 -0
  12. maxframe/core/entity/tileables.py +5 -78
  13. maxframe/core/graph/__init__.py +2 -2
  14. maxframe/core/graph/builder/__init__.py +0 -1
  15. maxframe/core/graph/builder/base.py +5 -4
  16. maxframe/core/graph/builder/tileable.py +4 -4
  17. maxframe/core/graph/builder/utils.py +4 -8
  18. maxframe/core/graph/core.cp39-win32.pyd +0 -0
  19. maxframe/core/graph/core.pyx +4 -4
  20. maxframe/core/graph/entity.py +9 -33
  21. maxframe/core/operator/__init__.py +2 -9
  22. maxframe/core/operator/base.py +3 -5
  23. maxframe/core/operator/objects.py +0 -9
  24. maxframe/core/operator/utils.py +55 -0
  25. maxframe/dataframe/__init__.py +1 -1
  26. maxframe/dataframe/arithmetic/around.py +5 -17
  27. maxframe/dataframe/arithmetic/core.py +15 -7
  28. maxframe/dataframe/arithmetic/docstring.py +7 -33
  29. maxframe/dataframe/arithmetic/equal.py +4 -2
  30. maxframe/dataframe/arithmetic/greater.py +4 -2
  31. maxframe/dataframe/arithmetic/greater_equal.py +4 -2
  32. maxframe/dataframe/arithmetic/less.py +2 -2
  33. maxframe/dataframe/arithmetic/less_equal.py +4 -2
  34. maxframe/dataframe/arithmetic/not_equal.py +4 -2
  35. maxframe/dataframe/arithmetic/tests/test_arithmetic.py +39 -16
  36. maxframe/dataframe/core.py +31 -7
  37. maxframe/dataframe/datasource/date_range.py +2 -2
  38. maxframe/dataframe/datasource/read_odps_query.py +117 -23
  39. maxframe/dataframe/datasource/read_odps_table.py +6 -3
  40. maxframe/dataframe/datasource/tests/test_datasource.py +103 -8
  41. maxframe/dataframe/datastore/tests/test_to_odps.py +48 -0
  42. maxframe/dataframe/datastore/to_odps.py +28 -0
  43. maxframe/dataframe/extensions/__init__.py +5 -0
  44. maxframe/dataframe/extensions/flatjson.py +131 -0
  45. maxframe/dataframe/extensions/flatmap.py +317 -0
  46. maxframe/dataframe/extensions/reshuffle.py +1 -1
  47. maxframe/dataframe/extensions/tests/test_extensions.py +108 -3
  48. maxframe/dataframe/groupby/core.py +1 -1
  49. maxframe/dataframe/groupby/cum.py +0 -1
  50. maxframe/dataframe/groupby/fill.py +4 -1
  51. maxframe/dataframe/groupby/getitem.py +6 -0
  52. maxframe/dataframe/groupby/tests/test_groupby.py +5 -1
  53. maxframe/dataframe/groupby/transform.py +5 -1
  54. maxframe/dataframe/indexing/align.py +1 -1
  55. maxframe/dataframe/indexing/loc.py +6 -4
  56. maxframe/dataframe/indexing/rename.py +5 -28
  57. maxframe/dataframe/indexing/sample.py +0 -1
  58. maxframe/dataframe/indexing/set_index.py +68 -1
  59. maxframe/dataframe/initializer.py +11 -1
  60. maxframe/dataframe/merge/__init__.py +9 -1
  61. maxframe/dataframe/merge/concat.py +41 -31
  62. maxframe/dataframe/merge/merge.py +237 -3
  63. maxframe/dataframe/merge/tests/test_merge.py +126 -1
  64. maxframe/dataframe/misc/apply.py +5 -10
  65. maxframe/dataframe/misc/case_when.py +1 -1
  66. maxframe/dataframe/misc/describe.py +2 -2
  67. maxframe/dataframe/misc/drop_duplicates.py +8 -8
  68. maxframe/dataframe/misc/eval.py +4 -0
  69. maxframe/dataframe/misc/memory_usage.py +2 -2
  70. maxframe/dataframe/misc/pct_change.py +1 -83
  71. maxframe/dataframe/misc/tests/test_misc.py +33 -2
  72. maxframe/dataframe/misc/transform.py +1 -30
  73. maxframe/dataframe/misc/value_counts.py +4 -17
  74. maxframe/dataframe/missing/dropna.py +1 -1
  75. maxframe/dataframe/missing/fillna.py +5 -5
  76. maxframe/dataframe/operators.py +1 -17
  77. maxframe/dataframe/reduction/core.py +2 -2
  78. maxframe/dataframe/reduction/tests/test_reduction.py +2 -4
  79. maxframe/dataframe/sort/sort_values.py +1 -11
  80. maxframe/dataframe/statistics/corr.py +3 -3
  81. maxframe/dataframe/statistics/quantile.py +13 -19
  82. maxframe/dataframe/statistics/tests/test_statistics.py +4 -4
  83. maxframe/dataframe/tests/test_initializer.py +33 -2
  84. maxframe/dataframe/utils.py +26 -11
  85. maxframe/dataframe/window/expanding.py +5 -3
  86. maxframe/dataframe/window/tests/test_expanding.py +2 -2
  87. maxframe/errors.py +13 -0
  88. maxframe/extension.py +12 -0
  89. maxframe/io/__init__.py +13 -0
  90. maxframe/io/objects/__init__.py +24 -0
  91. maxframe/io/objects/core.py +140 -0
  92. maxframe/io/objects/tensor.py +76 -0
  93. maxframe/io/objects/tests/__init__.py +13 -0
  94. maxframe/io/objects/tests/test_object_io.py +97 -0
  95. maxframe/{odpsio → io/odpsio}/__init__.py +3 -1
  96. maxframe/{odpsio → io/odpsio}/arrow.py +42 -10
  97. maxframe/{odpsio → io/odpsio}/schema.py +38 -16
  98. maxframe/io/odpsio/tableio.py +719 -0
  99. maxframe/io/odpsio/tests/__init__.py +13 -0
  100. maxframe/{odpsio → io/odpsio}/tests/test_schema.py +59 -22
  101. maxframe/{odpsio → io/odpsio}/tests/test_tableio.py +50 -23
  102. maxframe/{odpsio → io/odpsio}/tests/test_volumeio.py +4 -6
  103. maxframe/io/odpsio/volumeio.py +63 -0
  104. maxframe/learn/contrib/__init__.py +3 -1
  105. maxframe/learn/contrib/graph/__init__.py +15 -0
  106. maxframe/learn/contrib/graph/connected_components.py +215 -0
  107. maxframe/learn/contrib/graph/tests/__init__.py +13 -0
  108. maxframe/learn/contrib/graph/tests/test_connected_components.py +53 -0
  109. maxframe/learn/contrib/llm/__init__.py +16 -0
  110. maxframe/learn/contrib/llm/core.py +54 -0
  111. maxframe/learn/contrib/llm/models/__init__.py +14 -0
  112. maxframe/learn/contrib/llm/models/dashscope.py +73 -0
  113. maxframe/learn/contrib/llm/multi_modal.py +42 -0
  114. maxframe/learn/contrib/llm/text.py +42 -0
  115. maxframe/learn/contrib/xgboost/classifier.py +26 -2
  116. maxframe/learn/contrib/xgboost/core.py +87 -2
  117. maxframe/learn/contrib/xgboost/dmatrix.py +3 -6
  118. maxframe/learn/contrib/xgboost/predict.py +29 -46
  119. maxframe/learn/contrib/xgboost/regressor.py +3 -10
  120. maxframe/learn/contrib/xgboost/train.py +29 -18
  121. maxframe/{core/operator/fuse.py → learn/core.py} +7 -10
  122. maxframe/lib/mmh3.cp39-win32.pyd +0 -0
  123. maxframe/lib/mmh3.pyi +43 -0
  124. maxframe/lib/sparse/tests/test_sparse.py +15 -15
  125. maxframe/lib/wrapped_pickle.py +2 -1
  126. maxframe/opcodes.py +8 -0
  127. maxframe/protocol.py +154 -27
  128. maxframe/remote/core.py +4 -8
  129. maxframe/serialization/__init__.py +1 -0
  130. maxframe/serialization/core.cp39-win32.pyd +0 -0
  131. maxframe/serialization/core.pxd +3 -0
  132. maxframe/serialization/core.pyi +3 -0
  133. maxframe/serialization/core.pyx +67 -26
  134. maxframe/serialization/exception.py +1 -1
  135. maxframe/serialization/pandas.py +52 -17
  136. maxframe/serialization/serializables/core.py +180 -15
  137. maxframe/serialization/serializables/field_type.py +4 -1
  138. maxframe/serialization/serializables/tests/test_serializable.py +54 -5
  139. maxframe/serialization/tests/test_serial.py +2 -1
  140. maxframe/session.py +9 -2
  141. maxframe/tensor/__init__.py +81 -2
  142. maxframe/tensor/arithmetic/isclose.py +1 -0
  143. maxframe/tensor/arithmetic/tests/test_arithmetic.py +22 -18
  144. maxframe/tensor/core.py +5 -136
  145. maxframe/tensor/datasource/array.py +3 -0
  146. maxframe/tensor/datasource/full.py +1 -1
  147. maxframe/tensor/datasource/tests/test_datasource.py +1 -1
  148. maxframe/tensor/indexing/flatnonzero.py +1 -1
  149. maxframe/tensor/indexing/getitem.py +2 -0
  150. maxframe/tensor/merge/__init__.py +2 -0
  151. maxframe/tensor/merge/concatenate.py +101 -0
  152. maxframe/tensor/merge/tests/test_merge.py +30 -1
  153. maxframe/tensor/merge/vstack.py +74 -0
  154. maxframe/tensor/{base → misc}/__init__.py +2 -0
  155. maxframe/tensor/{base → misc}/atleast_1d.py +1 -3
  156. maxframe/tensor/misc/atleast_2d.py +70 -0
  157. maxframe/tensor/misc/atleast_3d.py +85 -0
  158. maxframe/tensor/misc/tests/__init__.py +13 -0
  159. maxframe/tensor/{base → misc}/transpose.py +22 -18
  160. maxframe/tensor/{base → misc}/unique.py +3 -3
  161. maxframe/tensor/operators.py +1 -7
  162. maxframe/tensor/random/core.py +1 -1
  163. maxframe/tensor/reduction/count_nonzero.py +2 -1
  164. maxframe/tensor/reduction/mean.py +1 -0
  165. maxframe/tensor/reduction/nanmean.py +1 -0
  166. maxframe/tensor/reduction/nanvar.py +2 -0
  167. maxframe/tensor/reduction/tests/test_reduction.py +12 -1
  168. maxframe/tensor/reduction/var.py +2 -0
  169. maxframe/tensor/statistics/quantile.py +2 -2
  170. maxframe/tensor/utils.py +2 -22
  171. maxframe/tests/test_protocol.py +34 -0
  172. maxframe/tests/test_utils.py +0 -12
  173. maxframe/tests/utils.py +17 -2
  174. maxframe/typing_.py +4 -1
  175. maxframe/udf.py +8 -9
  176. maxframe/utils.py +106 -86
  177. {maxframe-0.1.0b5.dist-info → maxframe-1.0.0.dist-info}/METADATA +25 -25
  178. {maxframe-0.1.0b5.dist-info → maxframe-1.0.0.dist-info}/RECORD +197 -173
  179. {maxframe-0.1.0b5.dist-info → maxframe-1.0.0.dist-info}/WHEEL +1 -1
  180. maxframe_client/__init__.py +0 -1
  181. maxframe_client/clients/framedriver.py +4 -1
  182. maxframe_client/fetcher.py +81 -74
  183. maxframe_client/session/consts.py +3 -0
  184. maxframe_client/session/graph.py +8 -2
  185. maxframe_client/session/odps.py +194 -40
  186. maxframe_client/session/task.py +94 -39
  187. maxframe_client/tests/test_fetcher.py +21 -3
  188. maxframe_client/tests/test_session.py +109 -8
  189. maxframe/core/entity/chunks.py +0 -68
  190. maxframe/core/entity/fuse.py +0 -73
  191. maxframe/core/graph/builder/chunk.py +0 -430
  192. maxframe/odpsio/tableio.py +0 -322
  193. maxframe/odpsio/volumeio.py +0 -95
  194. maxframe_client/clients/spe.py +0 -104
  195. /maxframe/{odpsio → core/entity}/tests/__init__.py +0 -0
  196. /maxframe/{tensor/base → dataframe/datastore}/tests/__init__.py +0 -0
  197. /maxframe/{odpsio → io/odpsio}/tests/test_arrow.py +0 -0
  198. /maxframe/tensor/{base → misc}/astype.py +0 -0
  199. /maxframe/tensor/{base → misc}/broadcast_to.py +0 -0
  200. /maxframe/tensor/{base → misc}/ravel.py +0 -0
  201. /maxframe/tensor/{base/tests/test_base.py → misc/tests/test_misc.py} +0 -0
  202. /maxframe/tensor/{base → misc}/where.py +0 -0
  203. {maxframe-0.1.0b5.dist-info → maxframe-1.0.0.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: bdist_wheel (0.44.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp39-cp39-win32
5
5
 
@@ -13,5 +13,4 @@
13
13
  # limitations under the License.
14
14
 
15
15
  from .clients.framedriver import FrameDriverClient
16
- from .clients.spe import SPEClient
17
16
  from .session import MaxFrameRestSession
@@ -63,9 +63,12 @@ class FrameDriverClient:
63
63
  session_id: str,
64
64
  dag: TileableGraph,
65
65
  managed_input_infos: Dict[str, ResultInfo] = None,
66
+ new_settings: Dict[str, Any] = None,
66
67
  ) -> DagInfo:
67
68
  req_url = f"{self._endpoint}/api/sessions/{session_id}/dags"
68
- req_body = ExecuteDagRequest(session_id, dag, managed_input_infos)
69
+ req_body = ExecuteDagRequest(
70
+ session_id, dag, managed_input_infos, new_settings=new_settings
71
+ )
69
72
  resp = await httpclient.AsyncHTTPClient().fetch(
70
73
  req_url,
71
74
  method="POST",
@@ -12,23 +12,26 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- import base64
16
- import json
17
15
  from abc import ABC, abstractmethod
18
16
  from numbers import Integral
19
- from typing import Any, Dict, List, Optional, Type, Union
17
+ from typing import Any, Dict, List, Optional, Tuple, Type, Union
20
18
 
21
19
  import pandas as pd
22
20
  import pyarrow as pa
23
21
  from odps import ODPS
24
- from odps.models import ExternalVolume, PartedVolume
22
+ from odps.models import ExternalVolume
25
23
  from odps.tunnel import TableTunnel
26
- from tornado import httpclient
27
24
 
28
25
  from maxframe.core import OBJECT_TYPE
29
26
  from maxframe.dataframe.core import DATAFRAME_TYPE
30
- from maxframe.lib import wrapped_pickle as pickle
31
- from maxframe.odpsio import HaloTableIO, arrow_to_pandas, build_dataframe_table_meta
27
+ from maxframe.io.objects import get_object_io_handler
28
+ from maxframe.io.odpsio import (
29
+ ODPSTableIO,
30
+ ODPSVolumeReader,
31
+ arrow_to_pandas,
32
+ build_dataframe_table_meta,
33
+ odps_schema_to_pandas_dtypes,
34
+ )
32
35
  from maxframe.protocol import (
33
36
  DataFrameTableMeta,
34
37
  ODPSTableResultInfo,
@@ -38,7 +41,7 @@ from maxframe.protocol import (
38
41
  )
39
42
  from maxframe.tensor.core import TENSOR_TYPE
40
43
  from maxframe.typing_ import PandasObjectTypes, TileableType
41
- from maxframe.utils import ToThreadMixin, deserialize_serializable
44
+ from maxframe.utils import ToThreadMixin, sync_pyodps_options
42
45
 
43
46
  _result_fetchers: Dict[ResultType, Type["ResultFetcher"]] = dict()
44
47
 
@@ -109,38 +112,70 @@ class ODPSTableFetcher(ToThreadMixin, ResultFetcher):
109
112
  tileable: TileableType,
110
113
  info: ODPSTableResultInfo,
111
114
  ) -> None:
112
- if isinstance(tileable, DATAFRAME_TYPE) and tileable.dtypes is None:
113
- tb_comment = await self.to_thread(
114
- self._get_table_comment, info.full_table_name
115
- )
116
- if tb_comment: # pragma: no branch
117
- comment_data = json.loads(tb_comment)
118
-
119
- table_meta: DataFrameTableMeta = deserialize_serializable(
120
- base64.b64decode(comment_data["table_meta"])
115
+ if (
116
+ isinstance(tileable, DATAFRAME_TYPE)
117
+ and tileable.dtypes is None
118
+ and info.table_meta is not None
119
+ ):
120
+ if info.table_meta.pd_column_dtypes is not None:
121
+ tileable.refresh_from_table_meta(info.table_meta)
122
+ else:
123
+ # need to get meta directly from table
124
+ table = self._odps_entry.get_table(info.full_table_name)
125
+ pd_dtypes = odps_schema_to_pandas_dtypes(table.table_schema).drop(
126
+ info.table_meta.table_index_column_names
121
127
  )
122
- tileable.refresh_from_table_meta(table_meta)
128
+ tileable.refresh_from_dtypes(pd_dtypes)
123
129
 
124
130
  if tileable.shape and any(pd.isna(x) for x in tileable.shape):
125
131
  part_specs = [None] if not info.partition_specs else info.partition_specs
126
- tunnel = TableTunnel(self._odps_entry)
127
- total_records = 0
128
- for part_spec in part_specs:
129
- session = tunnel.create_download_session(
130
- info.full_table_name, part_spec
131
- )
132
- total_records += session.count
132
+
133
+ with sync_pyodps_options():
134
+ table = self._odps_entry.get_table(info.full_table_name)
135
+ if isinstance(tileable, DATAFRAME_TYPE) and tileable.dtypes is None:
136
+ dtypes = odps_schema_to_pandas_dtypes(table.table_schema)
137
+ tileable.refresh_from_dtypes(dtypes)
138
+
139
+ tunnel = TableTunnel(self._odps_entry)
140
+ total_records = 0
141
+ for part_spec in part_specs:
142
+ session = tunnel.create_download_session(table, part_spec)
143
+ total_records += session.count
144
+
133
145
  new_shape_list = list(tileable.shape)
134
- new_shape_list[-1] = total_records
146
+ new_shape_list[0] = total_records
135
147
  tileable.params = {"shape": tuple(new_shape_list)}
136
148
 
149
+ @staticmethod
150
+ def _align_selection_with_shape(
151
+ row_sel: slice, shape: Tuple[Optional[int], ...]
152
+ ) -> dict:
153
+ size = shape[0]
154
+ if not row_sel.start and not row_sel.stop:
155
+ return {}
156
+ is_reversed = row_sel.step is not None and row_sel.step < 0
157
+ read_kw = {
158
+ "start": row_sel.start,
159
+ "stop": row_sel.stop,
160
+ "reverse_range": is_reversed,
161
+ }
162
+ if pd.isna(size):
163
+ return read_kw
164
+
165
+ if is_reversed and row_sel.start is not None:
166
+ read_kw["start"] = min(size - 1, row_sel.start)
167
+ if not is_reversed and row_sel.stop is not None:
168
+ read_kw["stop"] = min(size, row_sel.stop)
169
+ return read_kw
170
+
137
171
  def _read_single_source(
138
172
  self,
139
173
  table_meta: DataFrameTableMeta,
140
174
  info: ODPSTableResultInfo,
141
175
  indexes: List[Union[None, Integral, slice]],
176
+ shape: Tuple[Optional[int], ...],
142
177
  ):
143
- table_io = HaloTableIO(self._odps_entry)
178
+ table_io = ODPSTableIO(self._odps_entry)
144
179
  read_kw = {}
145
180
  row_step = None
146
181
  if indexes:
@@ -148,13 +183,8 @@ class ODPSTableFetcher(ToThreadMixin, ResultFetcher):
148
183
  indexes += [None]
149
184
  row_sel, col_sel = indexes
150
185
  if isinstance(row_sel, slice):
151
- if row_sel.start or row_sel.stop:
152
- read_kw["start"] = row_sel.start
153
- read_kw["stop"] = row_sel.stop
154
- read_kw["reverse_range"] = (
155
- row_sel.step is not None and row_sel.step < 0
156
- )
157
- row_step = row_sel.step
186
+ row_step = row_sel.step
187
+ read_kw = self._align_selection_with_shape(row_sel, shape)
158
188
  elif isinstance(row_sel, int):
159
189
  read_kw["start"] = row_sel
160
190
  read_kw["stop"] = row_sel + 1
@@ -173,8 +203,8 @@ class ODPSTableFetcher(ToThreadMixin, ResultFetcher):
173
203
  with table_io.open_reader(
174
204
  info.full_table_name, info.partition_specs, **read_kw
175
205
  ) as reader:
176
- reader_count = reader.count
177
206
  result = reader.read_all()
207
+ reader_count = result.num_rows
178
208
 
179
209
  if not row_step:
180
210
  return result
@@ -195,7 +225,7 @@ class ODPSTableFetcher(ToThreadMixin, ResultFetcher):
195
225
  ) -> PandasObjectTypes:
196
226
  table_meta = build_dataframe_table_meta(tileable)
197
227
  arrow_table: pa.Table = await self.to_thread(
198
- self._read_single_source, table_meta, info, indexes
228
+ self._read_single_source, table_meta, info, indexes, tileable.shape
199
229
  )
200
230
  return arrow_to_pandas(arrow_table, table_meta)
201
231
 
@@ -211,47 +241,24 @@ class ODPSVolumeFetcher(ToThreadMixin, ResultFetcher):
211
241
  ) -> None:
212
242
  return
213
243
 
214
- async def _read_parted_volume_data(
215
- self, volume: PartedVolume, partition: str, file_name: str
216
- ) -> bytes:
217
- def sync_read():
218
- with volume.open_reader(partition, file_name) as reader:
219
- return reader.read()
220
-
221
- return await self.to_thread(sync_read)
222
-
223
- async def _read_external_volume_data(
224
- self, volume: ExternalVolume, path: str, file_name: str
225
- ) -> bytes:
226
- signed_url = await self.to_thread(
227
- volume.get_sign_url, path + "/" + file_name, "GET"
228
- )
229
- http_client = httpclient.AsyncHTTPClient()
230
-
231
- resp = await http_client.fetch(signed_url)
232
- if hasattr(resp, "status_code") and resp.code >= 400:
233
- try:
234
- import oss2.exceptions
235
-
236
- oss_exc = oss2.exceptions.make_exception(resp.body)
237
- raise oss_exc
238
- except ImportError:
239
- raise SystemError(resp.body)
240
- return resp.body
244
+ async def _fetch_object(
245
+ self,
246
+ tileable: TileableType,
247
+ info: ODPSVolumeResultInfo,
248
+ indexes: List[Union[Integral, slice]],
249
+ ) -> Any:
250
+ def volume_fetch_func():
251
+ reader = ODPSVolumeReader(
252
+ self._odps_entry, info.volume_name, info.volume_path
253
+ )
254
+ io_handler = get_object_io_handler(tileable)()
255
+ return io_handler.read_object(reader, tileable, indexes)
241
256
 
242
- async def _fetch_object(self, info: ODPSVolumeResultInfo) -> Any:
243
257
  volume = await self.to_thread(self._odps_entry.get_volume, info.volume_name)
244
- if isinstance(volume, PartedVolume):
245
- byte_data = await self._read_parted_volume_data(
246
- volume, info.volume_path, "data"
247
- )
248
- elif isinstance(volume, ExternalVolume):
249
- byte_data = await self._read_external_volume_data(
250
- volume, info.volume_path, "data"
251
- )
258
+ if isinstance(volume, ExternalVolume):
259
+ return await self.to_thread(volume_fetch_func)
252
260
  else:
253
261
  raise NotImplementedError(f"Volume type {type(volume)} not supported")
254
- return pickle.loads(byte_data)
255
262
 
256
263
  async def fetch(
257
264
  self,
@@ -260,5 +267,5 @@ class ODPSVolumeFetcher(ToThreadMixin, ResultFetcher):
260
267
  indexes: List[Union[Integral, slice]],
261
268
  ) -> Any:
262
269
  if isinstance(tileable, (OBJECT_TYPE, TENSOR_TYPE)):
263
- return await self._fetch_object(info)
270
+ return await self._fetch_object(tileable, info, indexes)
264
271
  raise NotImplementedError(f"Fetching {type(tileable)} not implemented")
@@ -12,6 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ # retry consts
16
+ EMPTY_RESPONSE_RETRY_COUNT = 5
17
+
15
18
  # Restful Service
16
19
  RESTFUL_SESSION_INSECURE_SCHEME = "mf"
17
20
  RESTFUL_SESSION_SECURE_SCHEME = "mfs"
@@ -19,10 +19,16 @@ from dataclasses import dataclass
19
19
  from typing import Any, Dict, List, Tuple, Union
20
20
  from weakref import WeakSet
21
21
 
22
- from maxframe.core import ChunkType, TileableGraph, TileableType, enter_mode
22
+ from maxframe.core import (
23
+ ChunkType,
24
+ TileableGraph,
25
+ TileableType,
26
+ build_fetch,
27
+ enter_mode,
28
+ )
23
29
  from maxframe.core.operator import Fetch
24
30
  from maxframe.session import AbstractSession
25
- from maxframe.utils import build_fetch, copy_tileables
31
+ from maxframe.utils import copy_tileables
26
32
 
27
33
  logger = logging.getLogger(__name__)
28
34