Skip to content

[core] Deflake test_tpu by making it independent of the host's accelerators - #66356

Merged
ryanaoleary merged 1 commit into
ray-project:masterfrom
Yicheng-Lu-llll:deflake-test-tpu-accelerator-detection
Sep 22, 2026
Merged

ryanaoleary merged 1 commit into
ray-project:masterfrom
Yicheng-Lu-llll:deflake-test-tpu-accelerator-detection

Conversation

@Yicheng-Lu-llll

@Yicheng-Lu-llll Yicheng-Lu-llll commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Description

As title. Ray assumes one node can only have one accelerator, so it always chooses whichever it detects first, and the detection order is random. This PR makes sure we only detect TPU for TPU tests, no matter which machine we run on.

@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 refactors the TPU test suite in python/ray/tests/test_tpu.py by replacing a manual monkeypatch of TPUAcceleratorManager.get_current_node_num_accelerators with the mock_accelerator_detection context manager. I have no feedback to provide.

@Yicheng-Lu-llll Yicheng-Lu-llll added core Issues that should be addressed in Ray Core go add ONLY when ready to merge, run all tests labels Sep 21, 2026

@ryanaoleary ryanaoleary 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.

LGTM

@ryanaoleary
ryanaoleary merged commit fdd2b02 into ray-project:master Sep 22, 2026
6 checks passed
owenowenisme pushed a commit to owenowenisme/ray that referenced this pull request Sep 23, 2026
…rators (ray-project#66356)

## Description
As title. Ray assumes one node can only have one accelerator, so it
always chooses whichever it detects first, and the detection order is
random. This PR makes sure we only detect TPU for TPU tests, no matter
which machine we run on.

Signed-off-by: yicheng <[email protected]>
Co-authored-by: yicheng <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…rators (ray-project#66356)

## Description
As title. Ray assumes one node can only have one accelerator, so it
always chooses whichever it detects first, and the detection order is
random. This PR makes sure we only detect TPU for TPU tests, no matter
which machine we run on.

Signed-off-by: yicheng <[email protected]>
Co-authored-by: yicheng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core 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