(
ray_start_regular_shared_2_cpus,
restore_data_context,
disable_fallback_to_object_extension,
)
| 83 | |
| 84 | |
| 85 | def test_random_block_order( |
| 86 | ray_start_regular_shared_2_cpus, |
| 87 | restore_data_context, |
| 88 | disable_fallback_to_object_extension, |
| 89 | ): |
| 90 | ctx = DataContext.get_current() |
| 91 | ctx.execution_options.preserve_order = True |
| 92 | |
| 93 | # Test BlockList.randomize_block_order. |
| 94 | ds = ray.data.range(12).repartition(4) |
| 95 | ds = ds.randomize_block_order(seed=0) |
| 96 | |
| 97 | results = ds.take() |
| 98 | expected = named_values("id", [6, 7, 8, 0, 1, 2, 3, 4, 5, 9, 10, 11]) |
| 99 | assert results == expected |
| 100 | |
| 101 | # Test LazyBlockList.randomize_block_order. |
| 102 | lazy_blocklist_ds = ray.data.range(12, override_num_blocks=4) |
| 103 | lazy_blocklist_ds = lazy_blocklist_ds.randomize_block_order(seed=0) |
| 104 | lazy_blocklist_results = lazy_blocklist_ds.take() |
| 105 | lazy_blocklist_expected = named_values("id", [6, 7, 8, 0, 1, 2, 3, 4, 5, 9, 10, 11]) |
| 106 | assert lazy_blocklist_results == lazy_blocklist_expected |
| 107 | |
| 108 | |
| 109 | # NOTE: All tests above share a Ray cluster, while the tests below do not. These |
nothing calls this directly
no test coverage detected
searching dependent graphs…