Skip to content

[core] Add shared ClockInterface and fake clock for testing#62476

Merged
edoakes merged 40 commits into
ray-project:masterfrom
edoakes:eoakes/fake-clock
Apr 10, 2026
Merged

[core] Add shared ClockInterface and fake clock for testing#62476
edoakes merged 40 commits into
ray-project:masterfrom
edoakes:eoakes/fake-clock

Conversation

@edoakes

@edoakes edoakes commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

Wanted this for an upcoming PR for deterministic unit testing, so adding it here and replacing some existing tests that had their own version.

Was also able to make the timestamp checks in local_resource_manager_test.cc deterministic.

edoakes added 30 commits April 3, 2026 09:58
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
edoakes added 4 commits April 9, 2026 09:29
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
@edoakes edoakes requested a review from a team as a code owner April 9, 2026 18:38
@edoakes edoakes added the go add ONLY when ready to merge, run all tests label Apr 9, 2026
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>

@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 new ClockInterface and its implementations (Clock and FakeClock) to standardize time retrieval across the codebase, replacing direct absl::Now() calls and manual time-tracking logic in tests. The changes include updating various scheduling components and tests to inject the clock interface. The review feedback suggests marking the Now() methods as const and declaring the Clock and FakeClock classes as final to improve API design and enable potential compiler optimizations.

Comment thread src/ray/util/clock.h Outdated
Comment thread src/ray/util/clock.h Outdated
Comment thread src/ray/util/clock.h Outdated
Comment thread src/ray/util/clock.h Outdated
Comment thread src/ray/util/clock.h Outdated
edoakes added 3 commits April 9, 2026 11:45
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
@ray-gardener ray-gardener Bot added the core Issues that should be addressed in Ray Core label Apr 9, 2026
edoakes added 2 commits April 9, 2026 14:07
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>

@Yicheng-Lu-llll Yicheng-Lu-llll left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm!

@edoakes edoakes merged commit 262edcf into ray-project:master Apr 10, 2026
5 of 6 checks passed
HLDKNotFound pushed a commit to chichic21039/ray that referenced this pull request Apr 22, 2026
…oject#62476)

Wanted this for an upcoming PR for deterministic unit testing, so adding
it here and replacing some existing tests that had their own version.

Was also able to make the timestamp checks in
`local_resource_manager_test.cc` deterministic.

---------

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
edoakes added a commit that referenced this pull request May 13, 2026
- Update gcs components to use the interface introduced in:
#62476
- Updated tests to use `FakeClock`
- Added additional convenience methods to `ClockInterface`

---------

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Lucas61000 pushed a commit to Lucas61000/ray that referenced this pull request May 15, 2026
…oject#62476)

Wanted this for an upcoming PR for deterministic unit testing, so adding
it here and replacing some existing tests that had their own version.

Was also able to make the timestamp checks in
`local_resource_manager_test.cc` deterministic.

---------

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
edoakes added a commit that referenced this pull request May 29, 2026
…2562)

- Update Raylet subcomponents to use the interface introduced in:
#62476
- Updated tests to use FakeClock

---------

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
rueian pushed a commit to rueian/ray that referenced this pull request Jun 4, 2026
…y-project#62562)

- Update Raylet subcomponents to use the interface introduced in:
ray-project#62476
- Updated tests to use FakeClock

---------

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
limarkdcunha pushed a commit to limarkdcunha/ray that referenced this pull request Jun 30, 2026
…y-project#62562)

- Update Raylet subcomponents to use the interface introduced in:
ray-project#62476
- Updated tests to use FakeClock

---------

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
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

3 participants