Skip to content
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

[Core] Deflaky memory_monitor_test #44039

Merged
merged 1 commit into from
Mar 23, 2024
Merged

Conversation

jackhumphries
Copy link
Contributor

@jackhumphries jackhumphries commented Mar 15, 2024

MemoryMonitorTest::TestMonitorMinFreeZeroThresholdIsOne was failing because two floats were directly compared for equality rather than equality within a delta. I printed out the hex representation for both floats and saw the following:
0.4f has a hex representation of 0x1.99999ap-2
usage_threshold has a hex representation of 0x1.99999cp-2

Thus, the two floats are different.

I replaced ASSERT_EQ() with ASSERT_FLOAT_EQ() and the test now passes. There were also a couple other instances of checking for float equality that I updated to use ASSERT_FLOAT_EQ().

Tested: bazel test src/ray/common/test:memory_monitor_test

Why are these changes needed?

Fix for issue #44027

Related issue number

Close #44027

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

MemoryMonitorTest::TestMonitorMinFreeZeroThresholdIsOne was failing because two floats
were directly compared for equality rather than equality within a delta. I printed out the
hex representation for both floats and saw the following:
0.4f has a hex representation of 0x1.99999ap-2
usage_threshold has a hex representation of 0x1.99999cp-2

Thus, the two floats are different.

I replaced ASSERT_EQ() with ASSERT_FLOAT_EQ() and the test now passes. I also replaced a
couple other instances of checking for float equality using ASSERT_EQ() with
ASSERT_FLOAT_EQ().

Tested: bazel test src/ray/common/test:memory_monitor_test

Signed-off-by: Jack Humphries <[email protected]>
@jjyao jjyao changed the title Fix for issue #44027 (memory_monitor_test failure) [Core] Deflaky memory_monitor_test Mar 23, 2024
@jjyao jjyao merged commit 77ee044 into ray-project:master Mar 23, 2024
9 checks passed
jackhumphries added a commit to jackhumphries/ray that referenced this pull request Mar 23, 2024
@jackhumphries jackhumphries deleted the fix-44027 branch March 26, 2024 22:18
stephanie-wang pushed a commit to stephanie-wang/ray that referenced this pull request Mar 27, 2024
ryanaoleary pushed a commit to ryanaoleary/ray that referenced this pull request Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

memory_monitor_test fails
3 participants