class ray.data.datasource.RangeDatasource[source]#

Bases: ray.data.datasource.datasource.Datasource

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.



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

Launch Ray tasks for writing blocks out to the datasource.


Return a human-readable name for this 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.

write(blocks, **write_args)

Write blocks out to the datasource.