class ray.data.datasource.RangeDatasource(*args, **kwds)[source]#

An example datasource that generates ranges of numbers from [0..n).


>>> 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[, block_format, tensor_shape])

Return a Reader for the given read arguments.

do_write(blocks, metadata, ray_remote_args, ...)

Launch Ray tasks for writing blocks out to the datasource.

on_write_complete(write_results, **kwargs)

Callback for when a write job completes.

on_write_failed(write_results, error, **kwargs)

Callback for when a write job fails.

prepare_read(parallelism, **read_args)

Deprecated: Please implement create_reader() instead.