Skip to content

Conversation

@kyuds
Copy link
Member

@kyuds kyuds commented Dec 23, 2025

Description

Follow up to #59350

  • motivation: better abstraction for progress bars and type checking in general.

Related issues

N/A

Additional information

N/A

Signed-off-by: kyuds <[email protected]>
Signed-off-by: Daniel Shin <[email protected]>
Signed-off-by: Daniel Shin <[email protected]>
@kyuds kyuds requested a review from a team as a code owner December 23, 2025 13:08
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the progress bar system in Ray Data by introducing abstract base classes, BaseProgressBar and BaseExecutionProgressManager, to standardize progress reporting. Common progress bar logic, including block_until_complete and fetch_until_complete methods, along with utility functions like _extract_num_rows and truncate_operator_name, are moved into new dedicated _internal/progress modules. Existing progress bar implementations (ProgressBar, RichExecutionProgressManager, TqdmExecutionProgressManager) are updated to inherit from these new base classes, and type hints across various files are adjusted to reflect these changes. A review comment identified a bug in BaseProgressBar.fetch_until_complete where cancellation could lead to a KeyError due to an incomplete ref_to_result dictionary, suggesting that a RuntimeError should be raised instead of breaking the loop to handle cancellation explicitly.

Comment on lines +83 to +85
with _canceled_threads_lock:
if t in _canceled_threads:
break
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The break statement here will cause a KeyError on line 87 if the operation is cancelled, because ref_to_result will not contain all the refs. This is a bug. To handle cancellation correctly, you should raise an exception. This will make the cancellation explicit to the caller and prevent the unhandled exception.

Suggested change
with _canceled_threads_lock:
if t in _canceled_threads:
break
with _canceled_threads_lock:
if t in _canceled_threads:
raise RuntimeError("The fetch operation was cancelled.")

Copy link
Member Author

Choose a reason for hiding this comment

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

this is as per original implementation of progress bars...

@ray-gardener ray-gardener bot added data Ray Data-related issues community-contribution Contributed by the community labels Dec 23, 2025
Signed-off-by: Daniel Shin <[email protected]>
@kyuds kyuds added the go add ONLY when ready to merge, run all tests label Dec 25, 2025
@kyuds kyuds requested a review from bveeramani December 25, 2025 07:05
Copy link
Member

@bveeramani bveeramani left a comment

Choose a reason for hiding this comment

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

Nice

@bveeramani bveeramani merged commit f6140ce into ray-project:master Dec 26, 2025
7 checks passed
@kyuds kyuds deleted the progress-refactor-2-final branch December 30, 2025 13:12
@kyuds kyuds restored the progress-refactor-2-final branch December 30, 2025 13:12
@kyuds kyuds deleted the progress-refactor-2-final branch December 30, 2025 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community data Ray Data-related issues go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants