From 80e77f7025d4dfd28b6f78747a49eb76c463ad6a Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Fri, 3 Jan 2020 14:23:45 -0800 Subject: [PATCH] Revert accidental changes to test file. (#6681) --- python/ray/tests/test_basic.py | 41 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/python/ray/tests/test_basic.py b/python/ray/tests/test_basic.py index bc190cb78..a1e7f6d77 100644 --- a/python/ray/tests/test_basic.py +++ b/python/ray/tests/test_basic.py @@ -63,9 +63,6 @@ def test_simple_serialization(ray_start_regular): np.float64(1.9), ] - if sys.version_info < (3, 0): - primitive_objects.append(long(0)) # noqa: E501,F821 - composite_objects = ( [[obj] for obj in primitive_objects] + [(obj, ) @@ -91,6 +88,25 @@ def test_simple_serialization(ray_start_regular): assert type(obj) == type(new_obj_2) +def test_background_tasks_with_max_calls(shutdown_only): + ray.init(num_cpus=2) + + @ray.remote + def g(): + time.sleep(.1) + return 0 + + @ray.remote(max_calls=1, max_retries=0) + def f(): + return [g.remote()] + + nested = ray.get([f.remote() for _ in range(10)]) + + # Should still be able to retrieve these objects, since f's workers will + # wait for g to finish before exiting. + ray.get([x[0] for x in nested]) + + def test_fair_queueing(shutdown_only): ray.init( num_cpus=1, _internal_config=json.dumps({ @@ -166,17 +182,7 @@ def complex_serialization(use_pickle): assert obj1 == obj2, "Objects {} and {} are different.".format( obj1, obj2) - if sys.version_info >= (3, 0): - long_extras = [0, np.array([["hi", u"hi"], [1.3, 1]])] - else: - - long_extras = [ - long(0), # noqa: E501,F821 - np.array([ - ["hi", u"hi"], - [1.3, long(1)] # noqa: E501,F821 - ]) - ] + long_extras = [0, np.array([["hi", u"hi"], [1.3, 1]])] PRIMITIVE_OBJECTS = [ 0, 0.0, 0.9, 1 << 62, 1 << 100, 1 << 999, [1 << 100, [1 << 100]], "a", @@ -791,8 +797,6 @@ def test_keyword_args(ray_start_regular): assert ray.get(f3.remote(4)) == 4 -@pytest.mark.skipif( - sys.version_info < (3, 0), reason="This test requires Python 3.") @pytest.mark.parametrize( "ray_start_regular", [{ "local_mode": True @@ -828,8 +832,6 @@ def test_args_starkwargs(ray_start_regular): ray.get(remote_test_function.remote(local_method, actor_method)) -@pytest.mark.skipif( - sys.version_info < (3, 0), reason="This test requires Python 3.") @pytest.mark.parametrize( "ray_start_regular", [{ "local_mode": True @@ -871,8 +873,6 @@ def test_args_named_and_star(ray_start_regular): ray.get(remote_test_function.remote(local_method, actor_method)) -@pytest.mark.skipif( - sys.version_info < (3, 0), reason="This test requires Python 3.") @pytest.mark.parametrize( "ray_start_regular", [{ "local_mode": True @@ -1636,5 +1636,4 @@ def test_wait(ray_start_regular): if __name__ == "__main__": import pytest - import sys sys.exit(pytest.main(["-v", __file__]))