-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[dashboard] Fixes the CPU percent metrics for Dashboard process. #45124
Merged
Conversation
This file contains 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
The metrics `ray_component_cpu_percentage` for Dashboard is always 0. This is because every time we create a fresh `psutil.Process` instance. In the document it says: When *interval* is 0.0 or None (default) compares process times to system CPU times elapsed since last call, returning immediately (non-blocking). That means that the first time this is called it will return a meaningful 0.0 value. ... so we always get a 0.0 value. Further, in Kubernetes the CPU percentage should be based on the amount of CPUs available to the container. Both issues are already fixed in the `reporter_agent.py` file. We need to make the dashboard metrics comparable to that. This PR moves the CPU percentage calculation to a shared function in `metrics_utils.py` and uses it in both the agent code and the head code. Signed-off-by: Ruiyang Wang <rywang014@gmail.com>
rkooo567
approved these changes
May 3, 2024
jjyao
requested changes
May 3, 2024
Signed-off-by: Ruiyang Wang <rywang014@gmail.com>
Signed-off-by: Ruiyang Wang <rywang014@gmail.com>
jjyao
approved these changes
May 3, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you do a quick check in other places to see if this bug exists?
Signed-off-by: Ruiyang Wang <rywang014@gmail.com>
That's the only 2 metrics currently exposed by the dash (cpu, mem) both ok now. pls merge |
harborn
pushed a commit
to harborn/ray
that referenced
this pull request
May 8, 2024
…-project#45124) Signed-off-by: Ruiyang Wang <rywang014@gmail.com>
peytondmurray
pushed a commit
to peytondmurray/ray
that referenced
this pull request
May 13, 2024
…-project#45124) Signed-off-by: Ruiyang Wang <rywang014@gmail.com>
ryanaoleary
pushed a commit
to ryanaoleary/ray
that referenced
this pull request
Jun 6, 2024
…-project#45124) Signed-off-by: Ruiyang Wang <rywang014@gmail.com> Signed-off-by: Ryan O'Leary <ryanaoleary@google.com>
ryanaoleary
pushed a commit
to ryanaoleary/ray
that referenced
this pull request
Jun 7, 2024
…-project#45124) Signed-off-by: Ruiyang Wang <rywang014@gmail.com>
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.
The metrics
ray_component_cpu_percentage
for Dashboard is always 0. This is because every time we create a freshpsutil.Process
instance. In the document it says:... so we always get a 0.0 value.
This PR changes to cache the dash proc
psutil.Process
instance in the head module class so the estimation can be non-0. Note: the readings are CPU percentage since the last call so it's a 5 second (METRICS_RECORD_INTERVAL_S
) average.I tested on my laptop, the value matches output of
ps -p $PID -o %cpu
and an external psutil python script.