Skip to content

Consodiate CI Python tests and fix bug about multiple ray.init#4195

Merged
robertnishihara merged 7 commits intoray-project:masterfrom
antgroup:ci_pytest
Mar 1, 2019
Merged

Consodiate CI Python tests and fix bug about multiple ray.init#4195
robertnishihara merged 7 commits intoray-project:masterfrom
antgroup:ci_pytest

Conversation

@raulchen
Copy link
Copy Markdown
Contributor

What do these changes do?

Use the test directory as the parameter of pytest, instead of listing test files one by one. So we don't need to modify here when we add or remove test files. Also, it'd be easier to find the globally slowest test cases.

Also fixes #4192.

Related issue number

Closes #4192.

@raulchen
Copy link
Copy Markdown
Contributor Author

cc @williamma12

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12384/
Test FAILed.

worker = ray.worker.get_global_worker()
worker.check_connected()

if self._last_export_time < worker._last_shutdown_time:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems like a nice way to allow remote functions to be reused between multiple sessions without redefining them.

There are some moderately rare ways this could go wrong since time.time() is not monotone.

That could be fixed by using some sort of counter. E.g., the worker keeps some sort of session_index which increments every time you call shutdown. Then when a remote function is exported, we set its session_index equal to the worker's session_index.

I haven't thought through the details, but I'm not sure if this will work for nested remote functions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point.

worker = ray.worker.get_global_worker()
worker.check_connected()

if self._last_export_time < worker._last_shutdown_time:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also, was this fix needed to get some test working? If so, which one?

Copy link
Copy Markdown
Contributor Author

@raulchen raulchen Mar 1, 2019

Choose a reason for hiding this comment

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

Yeah, lots of tests will fail without this fix. Because when we pass in the test directory, pytest will first import all files. Then all the remote functions will only be exported to the first session. Also see #4192

Copy link
Copy Markdown
Contributor

@williamma12 williamma12 left a comment

Choose a reason for hiding this comment

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

Looks good, just a minor issue with comments! I am curious as to how the tests passed

EDIT: Nevermind I followed the issues back to #3897, which was why some of the tests were failing. Nice catch!

- python -m pytest -v --durations=10 python/ray/tests/test_credis.py
- python -m pytest -v --durations=10 python/ray/tests/test_node_manager.py
- python -m pytest -v --durations=10 python/ray/tests/test_signal.py
# TODO(yuhguo): object_manager_test.py requires a lot of CPU/memory, and
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.

Let's try to keep this comment in so we dont forget to move it over to jenkins eventually

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12412/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12414/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/12421/
Test FAILed.

@robertnishihara robertnishihara merged commit 6f1a29a into ray-project:master Mar 1, 2019
- python -m pytest -v --durations=10 python/ray/tune/test/ray_trial_executor_test.py
- python -m pytest -v --durations=10 python/ray/tune/test/automl_searcher_test.py
# `cluster_tests.py` runs on Jenkins, not Travis.
- python -m pytest -v --durations=30 --ignore=python/ray/tune/cluster_tests.py python/ray/tune/test
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm slightly surprised that this works because I thought pytest only picks up tests that have test_ as the start of the name. But it seems to be working..

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.

Problem with multiple ray.init and ray.shutdown

4 participants