ray.data.Dataset.num_blocks#

Dataset.num_blocks() int[source]#

Return the number of blocks of this dataset.

Note that during read and transform operations, the number of blocks may be dynamically adjusted to respect memory limits, increasing the number of blocks at runtime.

Examples

>>> import ray
>>> ds = ray.data.range(100).repartition(10)
>>> ds.num_blocks()
10

Time complexity: O(1)

Returns:

The number of blocks of this dataset.