Skip to content

Commit

Permalink
Add support for TileDB-Py 0.33
Browse files Browse the repository at this point in the history
Code was using internal function which no longer exists.
  • Loading branch information
ihnorton authored and ktsitsi committed Feb 19, 2025
1 parent e9eb15f commit 9c8cdcf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion tiledb/ml/readers/_tensor_schema/base_sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def key_range(self) -> WeightedRange[Any, int]:
@property
def max_partition_weight(self) -> int:
try:
memory_budget = int(self._array._ctx_().config()["py.init_buffer_bytes"])
# getattr for compatibility with TileDB-Py <0.33
ctx = getattr(self._array, "ctx", self._array._ctx_())
memory_budget = int(ctx.config()["py.init_buffer_bytes"])
except KeyError:
memory_budget = 10 * 1024**2

Expand Down
4 changes: 3 additions & 1 deletion tiledb/ml/readers/_tensor_schema/dense.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ def iter_tensors(

@property
def max_partition_weight(self) -> int:
memory_budget = int(self._array._ctx_().config()["sm.mem.total_budget"])
# getattr for compatibility with TileDB-Py <0.33
ctx = getattr(self._array, "ctx", self._array._ctx_())
memory_budget = int(ctx.config()["sm.mem.total_budget"])

# The memory budget should be large enough to read the cells of the largest field
bytes_per_cell = max(dtype.itemsize for dtype in self.field_dtypes)
Expand Down

0 comments on commit 9c8cdcf

Please sign in to comment.