(ray_start_cluster)
| 861 | |
| 862 | |
| 863 | def test_split_is_not_disruptive(ray_start_cluster): |
| 864 | ray.shutdown() |
| 865 | ds = ray.data.range(100, override_num_blocks=10).map_batches(lambda x: x) |
| 866 | |
| 867 | def verify_integrity(splits): |
| 868 | for dss in splits: |
| 869 | for batch in dss.iter_batches(): |
| 870 | pass |
| 871 | for batch in ds.iter_batches(): |
| 872 | pass |
| 873 | |
| 874 | # No block splitting invovled: split 10 even blocks into 2 groups. |
| 875 | verify_integrity(ds.split(2, equal=True)) |
| 876 | # Block splitting invovled: split 10 even blocks into 3 groups. |
| 877 | verify_integrity(ds.split(3, equal=True)) |
| 878 | |
| 879 | # Same as above but having tranforms post converting to lazy. |
| 880 | verify_integrity(ds.map_batches(lambda x: x).split(2, equal=True)) |
| 881 | verify_integrity(ds.map_batches(lambda x: x).split(3, equal=True)) |
| 882 | |
| 883 | # Same as above but having in-place tranforms post converting to lazy. |
| 884 | verify_integrity(ds.randomize_block_order().split(2, equal=True)) |
| 885 | verify_integrity(ds.randomize_block_order().split(3, equal=True)) |
| 886 | |
| 887 | |
| 888 | def test_streaming_train_test_split_hash(ray_start_regular_shared_2_cpus): |
nothing calls this directly
no test coverage detected
searching dependent graphs…