Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data] fix progress bar total not updated for streaming_split #43684

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

raulchen
Copy link
Contributor

@raulchen raulchen commented Mar 4, 2024

Why are these changes needed?

Fix the issue that streaming_split's total number of outputs are not updated in progress bar.
streaming_split doesn't have _estimated_output_blocks as the map does. but its num_outputs_total will inherit from the previous map.

In the following example, progress bar total should be updated to 10k.

import ray
import time
import numpy as np


ctx = ray.data.DataContext.get_current()
ctx.target_max_block_size = 10 * 1024 * 1024

ds = ray.data.range(1000, parallelism=1000)

def map_fn(_):
    for i in range(10):
        time.sleep(0.1)
        yield {
            "i": [np.ones(10 * 1024 * 1024, dtype=np.uint8)]
        }

ds = ds.map_batches(map_fn, batch_size=None)

split = ds.streaming_split(1)[0]

for _ in split.iter_batches(batch_size=None):
    pass

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Copy link
Contributor

@omatthew98 omatthew98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice quick fix! Verified locally lgtm with your script.

Copy link
Contributor

@c21 c21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@raulchen raulchen added the release-blocker P0 Issue that blocks the release label Mar 4, 2024
@raulchen raulchen merged commit 686b49f into ray-project:master Mar 4, 2024
8 of 9 checks passed
@raulchen raulchen deleted the fix-pbar-total branch March 4, 2024 22:06
ryanaoleary pushed a commit to ryanaoleary/ray that referenced this pull request Jun 7, 2024
Fix the issue that `streaming_split`'s total number of outputs are not updated in progress bar. 
`streaming_split` doesn't have `_estimated_output_blocks` as the map does. but its `num_outputs_total` will inherit from the previous map.

In the following example, progress bar total should be updated to 10k. 
```python
import ray
import time
import numpy as np


ctx = ray.data.DataContext.get_current()
ctx.target_max_block_size = 10 * 1024 * 1024

ds = ray.data.range(1000, parallelism=1000)

def map_fn(_):
    for i in range(10):
        time.sleep(0.1)
        yield {
            "i": [np.ones(10 * 1024 * 1024, dtype=np.uint8)]
        }

ds = ds.map_batches(map_fn, batch_size=None)

split = ds.streaming_split(1)[0]

for _ in split.iter_batches(batch_size=None):
    pass
```

Signed-off-by: Hao Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-blocker P0 Issue that blocks the release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants