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

[Datasets] Fix from_items parallelism to create the expected number of blocks. #32821

Merged

Conversation

clarkzinzow
Copy link
Contributor

Before this PR, when constructing blocks in alignment with the parallelism arg, from_items() used a buggy "calculate quotient and split on it" route which produced, when num_rows % parallelism != 0, both (1) more blocks than expected and (2) produced suboptimally balanced blocks. This PR fixes from_items() block construction by (1) always created parallelism blocks unless num_rows < parallelism, at which point we truncate the number of blocks to num_rows, and (2) evenly distributing the num_rows % parallelism remainder across the parallelism blocks while preserving record order.

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 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 :(

@clarkzinzow clarkzinzow changed the title [Datasets] Fix from_items parallelism to create the expected number of blocks. [Datasets] Fix from_items parallelism to create the expected number of blocks. Feb 24, 2023
@ericl ericl added the @author-action-required The PR author is responsible for the next step. Remove tag to send back to the reviewer. label Feb 24, 2023
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.

LGTM

@clarkzinzow clarkzinzow merged commit b3b8ba8 into ray-project:master Feb 24, 2023
edoakes pushed a commit to edoakes/ray that referenced this pull request Mar 22, 2023
… of blocks. (ray-project#32821)

Before this PR, when constructing blocks in alignment with the parallelism arg, from_items() used a buggy "calculate quotient and split on it" route which produced, when num_rows % parallelism != 0, both (1) more blocks than expected and (2) produced suboptimally balanced blocks.

This PR fixes from_items() block construction by (1) always created parallelism blocks unless num_rows < parallelism, at which point we truncate the number of blocks to num_rows, and (2) evenly distributing the num_rows % parallelism remainder across the parallelism blocks while preserving record order.

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
peytondmurray pushed a commit to peytondmurray/ray that referenced this pull request Mar 22, 2023
… of blocks. (ray-project#32821)

Before this PR, when constructing blocks in alignment with the parallelism arg, from_items() used a buggy "calculate quotient and split on it" route which produced, when num_rows % parallelism != 0, both (1) more blocks than expected and (2) produced suboptimally balanced blocks.

This PR fixes from_items() block construction by (1) always created parallelism blocks unless num_rows < parallelism, at which point we truncate the number of blocks to num_rows, and (2) evenly distributing the num_rows % parallelism remainder across the parallelism blocks while preserving record order.
elliottower pushed a commit to elliottower/ray that referenced this pull request Apr 22, 2023
… of blocks. (ray-project#32821)

Before this PR, when constructing blocks in alignment with the parallelism arg, from_items() used a buggy "calculate quotient and split on it" route which produced, when num_rows % parallelism != 0, both (1) more blocks than expected and (2) produced suboptimally balanced blocks.

This PR fixes from_items() block construction by (1) always created parallelism blocks unless num_rows < parallelism, at which point we truncate the number of blocks to num_rows, and (2) evenly distributing the num_rows % parallelism remainder across the parallelism blocks while preserving record order.

Signed-off-by: elliottower <elliot@elliottower.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@author-action-required The PR author is responsible for the next step. Remove tag to send back to the reviewer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants