ray.data.datasource.RangeDatasource
ray.data.datasource.RangeDatasource#
- class ray.data.datasource.RangeDatasource(*args, **kwds)[source]#
Bases:
ray.data.datasource.datasource.Datasource
[Union
[ray.data._internal.arrow_block.ArrowRow
,int
]]An example datasource that generates ranges of numbers from [0..n).
Examples
>>> import ray >>> from ray.data.datasource import RangeDatasource >>> source = RangeDatasource() >>> ray.data.read_datasource(source, n=10).take() [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
PublicAPI: This API is stable across Ray releases.
- create_reader(n: int, block_format: str = 'list', tensor_shape: Tuple = (1,)) List[ray.data.datasource.datasource.ReadTask] [source]#
Return a Reader for the given read arguments.
The reader object will be responsible for querying the read metadata, and generating the actual read tasks to retrieve the data blocks upon request.
- Parameters
read_args – Additional kwargs to pass to the datasource impl.