[Data] Fixed scheduling metrics computation#62031
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the op_runtime_metrics.py file to improve the accuracy of task scheduling and output backpressure metrics. Key changes include correcting the calculation of average_task_scheduling_time_s to use num_tasks_have_outputs instead of num_tasks_finished, and refactoring the on_task_output_generated method to correctly track the first output generation and associated timing. Minor updates include a clarification in a metric description and a formatting adjustment. There is no feedback to provide.
| return self.task_scheduling_time_s / self.num_tasks_finished | ||
| # NOTE: For correct calculation, we must use `num_tasks_have_outputs`, since | ||
| # scheduling time is incremented upon receiving of the first output | ||
| return self.task_scheduling_time_s / self.num_tasks_have_outputs |
Contributor
Contributor
Author
There was a problem hiding this comment.
Check how task_scheduling_time_s is incremented -- we increment it with the first output, hence denominator
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
4b69514 to
1c8a0ae
Compare
iamjustinhsu
approved these changes
Mar 25, 2026
Lucas61000
pushed a commit
to Lucas61000/ray
that referenced
this pull request
May 15, 2026
## Description Previously `average_task_scheduling_time_s` was computed incorrectly: - Cumulative scheduling duration was incremented whenever task would get first output - But denominator would only increase only when the task would finish Meaning that for the time while the task is running after first output is produced, but before it finishes the metric will be inflated, incorrectly. ## Related issues > Link related issues: "Fixes ray-project#1234", "Closes ray-project#1234", or "Related to ray-project#1234". ## Additional information > Optional: Add implementation details, API changes, usage examples, screenshots, etc. --------- Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Previously
average_task_scheduling_time_swas computed incorrectly:Meaning that for the time while the task is running after first output is produced, but before it finishes the metric will be inflated, incorrectly.
Related issues
Additional information