Skip to content

Commit

Permalink
[CI][Docs] Preserve block order during doctest (#36146)
Browse files Browse the repository at this point in the history
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>

Ray Data is non-deterministic. As a result, the 📖 Doctest (CPU) CI sometimes fails like this:
To decrease flakiness, this PR enables the preserve block order feature.
  • Loading branch information
bveeramani authored Jun 7, 2023
1 parent 07c5d86 commit 478704f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 6 additions & 0 deletions bazel/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@
def shutdown_ray():
ray.shutdown()
yield


@pytest.fixture(autouse=True)
def preserve_block_order():
ray.data.context.DataContext.get_current().execution_options.preserve_order = True
yield
3 changes: 0 additions & 3 deletions doc/source/data/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ Ray Data Glossary
.. doctest::

>>> import ray
>>> # Dataset is executed by streaming executor by default, which doesn't
>>> # preserve the order, so we explicitly set it here.
>>> ray.data.context.DataContext.get_current().execution_options.preserve_order = True
>>> dataset = ray.data.range(10)
>>> next(iter(dataset.iter_batches(batch_format="numpy", batch_size=5)))
{'id': array([0, 1, 2, 3, 4])}
Expand Down

0 comments on commit 478704f

Please sign in to comment.