mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 08:40:02 +08:00
Skip test_multithreading in Python 2 (#4107)
This commit is contained in:
@@ -12,6 +12,7 @@ import random
|
||||
import re
|
||||
import setproctitle
|
||||
import shutil
|
||||
import six
|
||||
import socket
|
||||
import string
|
||||
import subprocess
|
||||
@@ -1267,12 +1268,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():
|
||||
@@ -1370,8 +1375,8 @@ def test_multithreading(shutdown_only):
|
||||
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))
|
||||
@@ -1387,7 +1392,7 @@ def test_multithreading(shutdown_only):
|
||||
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, ))
|
||||
|
||||
Reference in New Issue
Block a user