Skip to content

Commit

Permalink
[idle term] fix on local resource idle time check (#41206)
Browse files Browse the repository at this point in the history
the timing check is too tight.

Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
  • Loading branch information
aslonnie authored Nov 16, 2023
1 parent b4a7f33 commit 10a1da1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/ray/raylet/scheduling/local_resource_manager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ TEST_F(LocalResourceManagerTest, IdleResourceTimeTest) {

ASSERT_NE(idle_time, absl::nullopt);
ASSERT_NE(*idle_time, absl::InfinitePast());
auto dur = absl::ToInt64Seconds(absl::Now() - *idle_time);
// Adds a 100ms buffer time. The idle time counting does not always
// guarantee to be strictly longer than the sleep time.
auto dur = absl::ToInt64Seconds(absl::Now() - *idle_time + absl::Milliseconds(100));
ASSERT_GE(dur, 1);
}

Expand Down Expand Up @@ -264,7 +266,9 @@ TEST_F(LocalResourceManagerTest, IdleResourceTimeTest) {
// Test allocates same resource have the right idle time.
auto idle_time = manager->GetResourceIdleTime();
ASSERT_TRUE(idle_time.has_value());
ASSERT_GE(absl::Now() - *idle_time, absl::Seconds(1));
// Gives it 100ms buffer time. The idle time counting does not always
// guarantee that it is larger than 1 second after a 1 second sleep.
ASSERT_GE(absl::Now() - *idle_time, absl::Seconds(1) - absl::Milliseconds(100));
}

// Allocate the resource
Expand Down

0 comments on commit 10a1da1

Please sign in to comment.