Skip to content

Add option to disable gpu metrics collection - #65809

Merged
sampan-s-nayak merged 4 commits into
ray-project:masterfrom
pawelbeza:pawelbeza/optionally-disable-gpu-metrics-collection
Nov 3, 2026
Merged

sampan-s-nayak merged 4 commits into
ray-project:masterfrom
pawelbeza:pawelbeza/optionally-disable-gpu-metrics-collection

Conversation

@pawelbeza

Copy link
Copy Markdown
Contributor

Description

Ray’s dashboard reporter periodically polls NVML for GPU metrics. In some
environments, these calls can contend with other GPU operations and contribute
to kernel lockups or panics.

Reducing the polling frequency only mitigates the problem. Deployments using
external GPU observability need a way to disable NVML polling completely.

Related issues

Fixes #65808

@pawelbeza
pawelbeza requested a review from a team as a code owner August 31, 2026 17:11

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

Copy link
Copy Markdown
Contributor

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 introduces a configuration option to disable GPU metrics collection in the Ray dashboard agent, which helps avoid unnecessary polling of GPU management libraries like NVML. The feedback highlights three key improvements: maintaining backward compatibility in DashboardAgent.__init__ by adjusting the parameter order, optimizing GpuMetricProvider to avoid instantiating GPU providers when metrics are disabled, and defensively accessing gpu_metrics_enabled using getattr to prevent potential AttributeError issues in tests or custom implementations.

Comment thread python/ray/dashboard/agent.py Resolved
@ray-gardener ray-gardener Bot added core Issues that should be addressed in Ray Core community-contribution Contributed by the community labels Aug 31, 2026
@Kunchd Kunchd self-assigned this Aug 31, 2026
@pawelbeza
pawelbeza force-pushed the pawelbeza/optionally-disable-gpu-metrics-collection branch from 9470ec7 to 9550497 Compare September 1, 2026 11:03
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Sep 15, 2026

@Kunchd Kunchd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR! Looks good overall, I left a few nits.

Comment thread python/ray/dashboard/agent.py Resolved
@github-actions github-actions Bot added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels Sep 16, 2026
@pawelbeza
pawelbeza force-pushed the pawelbeza/optionally-disable-gpu-metrics-collection branch from 14180c4 to d39993e Compare September 23, 2026 14:11
@pawelbeza

Copy link
Copy Markdown
Contributor Author

@Kunchd sorry for late reply, addressed your comments!

@pawelbeza
pawelbeza requested a review from Kunchd September 23, 2026 14:12

@Kunchd Kunchd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry for the delayed response. Looks good thanks!

Pawel Beza and others added 3 commits October 29, 2026 18:04
Co-authored-by: Eslam Elnikety <[email protected]>
Signed-off-by: Eslam Elnikety <[email protected]>
Signed-off-by: Paweł Bęza <[email protected]>
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Pawel Beza <[email protected]>
Co-authored-by: Eslam Elnikety <[email protected]>
Signed-off-by: Eslam Elnikety <[email protected]>
Signed-off-by: Paweł Bęza <[email protected]>
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Pawel Beza <[email protected]>
Co-authored-by: Eslam Elnikety <[email protected]>
Signed-off-by: Eslam Elnikety <[email protected]>
Signed-off-by: Paweł Bęza <[email protected]>
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Pawel Beza <[email protected]>
auto-merge was automatically disabled October 30, 2026 01:06

Head branch was pushed to by a user without write access

@pawelbeza
pawelbeza force-pushed the pawelbeza/optionally-disable-gpu-metrics-collection branch from d39993e to 165dbe0 Compare October 30, 2026 01:06
@sampan-s-nayak
sampan-s-nayak enabled auto-merge (squash) November 3, 2026 06:30
@github-actions
github-actions Bot disabled auto-merge November 3, 2026 06:30
@sampan-s-nayak
sampan-s-nayak merged commit 37fcad8 into ray-project:master Nov 3, 2026
7 checks passed
dstrodtman added a commit that referenced this pull request Nov 4, 2026
## Description

This PR makes the `lint: API param coverage` step a required check by
removing `soft_fail: true`. The step was added in #64788 on 2026-08-11.
A comment in the step said to remove `soft_fail` "once the
false-positive rate is confirmed low." This PR measures that rate from
the step's CI history and fixes the four failure patterns the history
turned up.

While the step only warns, undocumented parameters still land on master.
#65633, #66602, and #66950 all merged with the check failing.

### Warn-phase metrics

These numbers come from every `premerge` build from 2026-08-11 to
2026-10-29, pulled from the Buildkite API.

| | Runs | PRs |
|---|--:|--:|
| Completed runs of the step | 3,453 | |
| Passed | 3,398 | |
| Failed | 55 | 23 |
| Canceled, which isn't a check outcome | 211 | |

Each failure falls into one of three groups:

| Failure type | PRs | Runs | Detail |
|---|--:|--:|---|
| Correct finding | 15 | 42 | A new parameter on a `@PublicAPI` callable
has no `Args:` entry. Two of these PRs, #65823 and #65839, were stacked
on #65633 before it merged and report its findings again. |
| False positive | 3 | 4 | #64399 flagged the `v` argument of a pydantic
`@field_validator`. #66255 flagged the private kwarg `_direct_http`.
#67258 flagged an option of the `ray start` Click command, which `help=`
documents. |
| Infrastructure | 5 | 9 | The step printed `could not determine
merge-base` and no findings. The branches of #65437 and #65809 forked
520 and 598 master commits before their builds. The step's `git fetch
--depth=500` makes the full CI clone shallow, so their merge-base wasn't
in the fetched history. |

That's 13 spurious failures out of 3,453 runs, about 0.4%, or 13 of 55
failures. Each one would block a PR once the step is required, so this
PR fixes all four patterns before removing `soft_fail`.

### Changes

- **`_`-prefixed parameters:** `api_param_coverage.py` skips parameters
whose names start with `_`. That's Ray's convention for private kwargs,
such as `ray.put(_owner=...)`, `tune.run(_remote=...)`, and
`Deployment.options(_internal=...)`. On master, 31 public callables have
such parameters.
- **Pydantic validators and Click commands:** The script skips callables
decorated with `field_validator`, `model_validator`, `validator`,
`root_validator`, `command`, or `group`. On master, this removes 59
callables from scope. All of them are Click commands, such as `ray
start` and `ray job submit`, or pydantic validators on Serve config
models. None of them is a Python API whose parameters a docstring
documents.
- **Property setters:** The script also skips callables decorated with
`@<name>.setter`. A setter's `value` is documented on the property's
getter, which is the docstring Sphinx renders, not in an `Args:` section
of its own.
- **Shallow-clone merge-base:** When `git merge-base` fails after the
depth-500 fetch, `ci/lint/lint.sh` runs `git fetch --unshallow` and
retries. A branch within 500 commits of the base never reaches that
path. The Python check still fails closed if the base can't be resolved
after that.
- **Step definition:** `.buildkite/lint.rayci.yml` drops `soft_fail:
true` and the warn-phase comment. The `--blocking` help text in
`cmd_check_api_param_coverage.py` no longer describes a warn phase.

## Related issues

Follow-up to #64788.

## Additional information

### Testing

- `pytest ci/ray_ci/doc/test_api_param_coverage.py`: 40 passed. That's
the 28 existing tests plus 12 new cases covering `_` params, each
validator spelling, Click command forms, and property setters. The test
comments name the real PR that motivated each one.
- **Replay against real PRs:** I ran the master and patched versions of
the check against the exact commit and base of every failing run in each
of the 18 PRs with findings. Master reproduces all 18 failures. The
patched check passes #64399, #66255, and #67258, and reports the same
findings as master on the other 15.
- **Merge-base fix:** In a local repo with 600 commits on `master` and a
branch forked at commit 50, `git fetch --depth=500` followed by `git
merge-base` fails, which reproduces the CI failure. With the new
`lint.sh` block, it resolves the correct fork commit. A branch forked 10
commits back resolves without the fallback.
- `pre-commit run` on the changed files passes, including ruff, black,
shellcheck, and docstyle.

### Duplicate check

`gh pr list --state open --search "param coverage"` and `--search
"api_param_coverage"` return no open PR that touches this check. The
script hasn't changed since #65391 on 2026-08-14.

### AI assistance

I used Claude Code to pull and classify the Buildkite history, draft the
changes, and run the replay. I reviewed every changed line and the
classification of every failing PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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 core Issues that should be addressed in Ray Core go add ONLY when ready to merge, run all tests unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an option to disable GPU metric polling

3 participants