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

Skip test_multithreading in Python 2 #4107

Merged
merged 4 commits into from
Feb 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions python/ray/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import re
import setproctitle
import shutil
import six
import socket
import string
import subprocess
Expand Down Expand Up @@ -1273,12 +1274,16 @@ def test_illegal_api_calls(shutdown_only):
ray.get(3)


# TODO(hchen): This test currently doesn't work in Python 2. This is likely
# because plasma client isn't thread-safe. This needs to be fixed from the
# Arrow side. See #4107 for relevant discussions.
@pytest.mark.skipif(six.PY2, reason="Doesn't work in Python 2.")
def test_multithreading(shutdown_only):
# This test requires at least 2 CPUs to finish since the worker does not
# relase resources when joining the threads.
# release resources when joining the threads.
ray.init(num_cpus=2)

def run_test_in_multi_threads(test_case, num_threads=20, num_repeats=50):
def run_test_in_multi_threads(test_case, num_threads=10, num_repeats=25):
"""A helper function that runs test cases in multiple threads."""

def wrapper():
Expand Down Expand Up @@ -1376,8 +1381,8 @@ def background_thread(self, wait_objects):
timeout=1000.0,
)
assert len(ready) == len(wait_objects)
for _ in range(50):
num = 20
for _ in range(20):
num = 10
# Test remote call
results = [echo.remote(i) for i in range(num)]
assert ray.get(results) == list(range(num))
Expand All @@ -1393,7 +1398,7 @@ def background_thread(self, wait_objects):
self.thread_results.append("ok")

def spawn(self):
wait_objects = [echo.remote(i, delay_ms=10) for i in range(20)]
wait_objects = [echo.remote(i, delay_ms=10) for i in range(10)]
self.threads = [
threading.Thread(
target=self.background_thread, args=(wait_objects, ))
Expand Down