Repository navigation
[Data] Update the export API to refresh the dataset and operator states - #55355
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @coqian, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request significantly enhances the observability of Ray Data workflows by enriching the export API with detailed lifecycle information for datasets and their operators. It introduces new state tracking, including execution start and end times, and ensures that this metadata is continuously updated and exported as the execution progresses. These changes will enable more precise monitoring and analysis of data processing performance.
Highlights
- Enhanced Export API Schema: I've extended the export API schema for both datasets and operators to include crucial lifecycle metadata:
state,execution_start_time, andexecution_end_time. These fields are vital for observing the lifecycle of data processing workflows and improving the accuracy of reported metrics. - New
PENDINGState: A newPENDINGstate has been introduced for both datasets and operators. This state accurately represents their status when they have been registered but are not yet actively running, providing a more granular view of their lifecycle. - Real-time Metadata Refresh: The system now actively refreshes and exports dataset and operator metadata whenever their state is updated. This ensures that the exported events always contain the latest snapshot of all relevant metadata, including their current state and execution timings.
- Centralized State Management: The
DatasetStateenum definition has been centralized into its own dedicated file (dataset_state.py), improving code organization and reusability across the Ray Data module.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request enhances the data export API by adding state, execution_start_time, and execution_end_time to dataset and operator metadata. This is a great improvement for observability. The implementation is solid, with a new PENDING state for better lifecycle tracking and logic to refresh metadata on state changes. The accompanying tests cover the new functionality well. I've offered one suggestion to improve code conciseness.
71b4740 to
7e1bfd9
Compare
| # Set the appropriate description that summarizes | ||
| # the result of dataset execution. | ||
| if exception is None: | ||
| StatsManager.update_dataset_metadata_state( |
There was a problem hiding this comment.
@coqian why don't we move this into _update_stats_metrics method?
Same question for all the hooks added here
There was a problem hiding this comment.
@alexeykudinkin Personally, I prefer separating metadata update from metrics because of two differences between them:
- Metadata contains descriptive fields that rarely get updated, such as state, timestamp; while metrics report numeric time series values as job runs.
- The frequency to update them: we only export metadata when there is a state change; while for metrics, the
_update_stats_metricswill be called frequently to report the value update.
can-anyscale
left a comment
There was a problem hiding this comment.
data team should review i think, stamp for the protobuf change
c2e9988 to
991b41f
Compare
There was a problem hiding this comment.
Can you help me understand why wouldn't we just inherit from str instead?
There was a problem hiding this comment.
Created this file from existing code by @omatthew98. I think the reason is that the state enum value type is defined as int for downstream usage, such as Prometheus, so there will be base type conflicts if inheriting from str at the same time.
There was a problem hiding this comment.
Let's avoid modifying objects in place and instead create a new object
There was a problem hiding this comment.
Added a deepcopy of dataset_metadata before updating any values, and then modified the copy instead
There was a problem hiding this comment.
Same comment as above
There was a problem hiding this comment.
Added a deepcopy of dataset_metadata before updating any values, and then modified the copy instead
991b41f to
84da1fe
Compare
There was a problem hiding this comment.
This will be making N copies, where N is the number of operators in the dataset.
Instead let's make just 1 copy and update all states at once
There was a problem hiding this comment.
Modified the code to be able to update multiple operators in a single call, and only create one copy of the dataset metadata.
a9500c6 to
471e5af
Compare
Signed-off-by: cong.qian <[email protected]>
Head branch was pushed to by a user without write access
837369e to
4e1807b
Compare
…es (ray-project#55355) <!-- Thank you for your contribution! Please review https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? This PR is a revert of [ray-project#55333](ray-project#55333) and resolves conflict by [ray-project#55163](ray-project#55163) Original description: Some frequently used metadata fields are missing in the export API schema: - For both dataset and operator: state, execution start and end time These fields are important for us to observe the lifecycle of the datasets and operators, and can be used to improve the accuracy of reported metrics, such as throughput, which relies on the duration. <!-- Please give a short summary of the change and the problem this solves. --> Summary of change: - Add state, execution start and end time at the export API schema - Add a new state enum `PENDING` for dataset and operator, to represent the state when they are not running yet. - Refresh the metadata when ever the state of dataset/operator gets updated. And the event will always contains the latest snapshot of all the metadata. ## Related issue number <!-- For example: "Closes ray-project#1234" --> ## Checks - [X] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [X] 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 - [X] Unit tests - [ ] Release tests - [ ] This PR is not tested :( Signed-off-by: cong.qian <[email protected]> Signed-off-by: Andrew Grosser <[email protected]>
…es (ray-project#55355) <!-- Thank you for your contribution! Please review https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? This PR is a revert of [ray-project#55333](ray-project#55333) and resolves conflict by [ray-project#55163](ray-project#55163) Original description: Some frequently used metadata fields are missing in the export API schema: - For both dataset and operator: state, execution start and end time These fields are important for us to observe the lifecycle of the datasets and operators, and can be used to improve the accuracy of reported metrics, such as throughput, which relies on the duration. <!-- Please give a short summary of the change and the problem this solves. --> Summary of change: - Add state, execution start and end time at the export API schema - Add a new state enum `PENDING` for dataset and operator, to represent the state when they are not running yet. - Refresh the metadata when ever the state of dataset/operator gets updated. And the event will always contains the latest snapshot of all the metadata. ## Related issue number <!-- For example: "Closes ray-project#1234" --> ## Checks - [X] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [X] 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 - [X] Unit tests - [ ] Release tests - [ ] This PR is not tested :( Signed-off-by: cong.qian <[email protected]> Signed-off-by: jugalshah291 <[email protected]>
…es (#55355) <!-- Thank you for your contribution! Please review https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? This PR is a revert of [#55333](#55333) and resolves conflict by [#55163](#55163) Original description: Some frequently used metadata fields are missing in the export API schema: - For both dataset and operator: state, execution start and end time These fields are important for us to observe the lifecycle of the datasets and operators, and can be used to improve the accuracy of reported metrics, such as throughput, which relies on the duration. <!-- Please give a short summary of the change and the problem this solves. --> Summary of change: - Add state, execution start and end time at the export API schema - Add a new state enum `PENDING` for dataset and operator, to represent the state when they are not running yet. - Refresh the metadata when ever the state of dataset/operator gets updated. And the event will always contains the latest snapshot of all the metadata. ## Related issue number <!-- For example: "Closes #1234" --> ## Checks - [X] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [X] 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 - [X] Unit tests - [ ] Release tests - [ ] This PR is not tested :( Signed-off-by: cong.qian <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
… op args when refreshing metadata (#58755) ## Description We export dataset and operator metadata whenever there is a state change. However, the size of the export file can be very large because the metadata also includes the DataContext config and operator args, which does not change over time, and they will be written multiple times to the file. To reduce the file size and remove redundant info, we can only export DataContext and operator args when the dataset is [registered](https://github.com/ray-project/ray/blob/d1cce8c9dc8411fad7cfbd619350bec6f19839a3/python/ray/data/_internal/stats.py#L621), and avoid them in the later state updates. ## Related issues Related previous PRs: [55355](#55355), [53554](#53554) Signed-off-by: cong.qian <[email protected]>
… op args when refreshing metadata (ray-project#58755) ## Description We export dataset and operator metadata whenever there is a state change. However, the size of the export file can be very large because the metadata also includes the DataContext config and operator args, which does not change over time, and they will be written multiple times to the file. To reduce the file size and remove redundant info, we can only export DataContext and operator args when the dataset is [registered](https://github.com/ray-project/ray/blob/d1cce8c9dc8411fad7cfbd619350bec6f19839a3/python/ray/data/_internal/stats.py#L621), and avoid them in the later state updates. ## Related issues Related previous PRs: [55355](ray-project#55355), [53554](ray-project#53554) Signed-off-by: cong.qian <[email protected]>
Why are these changes needed?
This PR is a revert of #55333 and resolves conflict by #55163
Original description:
Some frequently used metadata fields are missing in the export API schema:
These fields are important for us to observe the lifecycle of the datasets and operators, and can be used to improve the accuracy of reported metrics, such as throughput, which relies on the duration.
Summary of change:
PENDINGfor dataset and operator, to represent the state when they are not running yet.Related issue number
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.