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

Ensure no ghost ray instances are running in tests #2607

Merged
merged 4 commits into from
Oct 7, 2022

Conversation

arnavgarg1
Copy link
Contributor

@arnavgarg1 arnavgarg1 commented Oct 7, 2022

This PR ensures that tests that use a Ray backend and initialize Ray always call ray.shutdown() so that there are no ghost ray instances running in subsequent tests. This causes a problem for downstream tests that want to either initialize ray manually or through a test fixture, because they try to re-initialize ray. If one decides to add the ignore_reinit_error=True attribute to the ray.init() call like the failure suggests, it causes the test to misbehave since it initializes a ray cluster with a completely different number of CPUs.

The fix is just as simple as adding this text fixture to tests, so that Ray isn't initialized by the test (only by the fixture) and it is calls the teardown function automatically at the end of each module.

Copy link
Collaborator

@tgaddair tgaddair left a comment

Choose a reason for hiding this comment

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

Great work!

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

Unit Test Results

         4 files  ±0         4 suites  ±0   1h 49m 43s ⏱️ - 24m 47s
  3 438 tests ±0  3 364 ✔️ ±0    74 💤 ±0  0 ±0 
10 032 runs  ±0  9 825 ✔️ ±0  207 💤 ±0  0 ±0 

Results for commit ff5eff0. ± Comparison against base commit 9f26bf9.

@arnavgarg1 arnavgarg1 merged commit 0f50932 into master Oct 7, 2022
@arnavgarg1 arnavgarg1 deleted the test_fixtures_with_ray branch October 7, 2022 01:11
arnavgarg1 added a commit that referenced this pull request Oct 14, 2022
* Add test fixtures to prevent double initialization

* contain dataframe utils test in ray test fixture

* add fixture for training determinism test

* fix typo in docstring
arnavgarg1 added a commit that referenced this pull request Oct 14, 2022
* Add test fixtures to prevent double initialization

* contain dataframe utils test in ray test fixture

* add fixture for training determinism test

* fix typo in docstring
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.

None yet

2 participants