6412dfaf383e84e5662cf4bfd3be3927de42e8e1,python/ray/tests/test_experimental_client.py,,test_wait,#Any#,63

Before Change




def test_wait(ray_start_regular_shared):
    server = ray_client_server.serve("localhost:50051", test_mode=True)
    ray.connect("localhost:50051")

    objectref = ray.put("hello world")
    ready, remaining = ray.wait([objectref])
    assert remaining == []
    retval = ray.get(ready[0])
    assert retval == "hello world"

    objectref2 = ray.put(5)
    ready, remaining = ray.wait([objectref, objectref2])
    assert (ready, remaining) == ([objectref], [objectref2]) or \
        (ready, remaining) == ([objectref2], [objectref])
    ready_retval = ray.get(ready[0])
    remaining_retval = ray.get(remaining[0])
    assert (ready_retval, remaining_retval) == ("hello world", 5) \
        or (ready_retval, remaining_retval) == (5, "hello world")

    with pytest.raises(Exception):
        // Reference not in the object store.
        ray.wait([ClientObjectRef("blabla")])
    with pytest.raises(AssertionError):
        ray.wait("blabla")
    with pytest.raises(AssertionError):
        ray.wait(ClientObjectRef("blabla"))
    with pytest.raises(AssertionError):
        ray.wait(["blabla"])

    ray.disconnect()
    server.stop(0)


def test_remote_functions(ray_start_regular_shared):
    server = ray_client_server.serve("localhost:50051", test_mode=True)

After Change




def test_wait(ray_start_regular_shared):
    with ray_start_client_server() as ray:
        objectref = ray.put("hello world")
        ready, remaining = ray.wait([objectref])
        assert remaining == []
        retval = ray.get(ready[0])
        assert retval == "hello world"

        objectref2 = ray.put(5)
        ready, remaining = ray.wait([objectref, objectref2])
        assert (ready, remaining) == ([objectref], [objectref2]) or \
            (ready, remaining) == ([objectref2], [objectref])
        ready_retval = ray.get(ready[0])
        remaining_retval = ray.get(remaining[0])
        assert (ready_retval, remaining_retval) == ("hello world", 5) \
            or (ready_retval, remaining_retval) == (5, "hello world")

        with pytest.raises(Exception):
            // Reference not in the object store.
            ray.wait([ClientObjectRef("blabla")])
        with pytest.raises(AssertionError):
            ray.wait("blabla")
        with pytest.raises(AssertionError):
            ray.wait(ClientObjectRef("blabla"))
        with pytest.raises(AssertionError):
            ray.wait(["blabla"])


def test_remote_functions(ray_start_regular_shared):
    with ray_start_client_server() as ray:

        @ray.remote
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 6

Non-data size: 11

Instances


Project Name: ray-project/ray
Commit Name: 6412dfaf383e84e5662cf4bfd3be3927de42e8e1
Time: 2020-12-01
Author: me@barakmich.com
File Name: python/ray/tests/test_experimental_client.py
Class Name:
Method Name: test_wait


Project Name: ray-project/ray
Commit Name: 6412dfaf383e84e5662cf4bfd3be3927de42e8e1
Time: 2020-12-01
Author: me@barakmich.com
File Name: python/ray/tests/test_experimental_client.py
Class Name:
Method Name: test_put_get


Project Name: ray-project/ray
Commit Name: 6412dfaf383e84e5662cf4bfd3be3927de42e8e1
Time: 2020-12-01
Author: me@barakmich.com
File Name: python/ray/tests/test_experimental_client.py
Class Name:
Method Name: test_real_ray_fallback


Project Name: ray-project/ray
Commit Name: 6412dfaf383e84e5662cf4bfd3be3927de42e8e1
Time: 2020-12-01
Author: me@barakmich.com
File Name: python/ray/tests/test_experimental_client.py
Class Name:
Method Name: test_function_calling_function


Project Name: ray-project/ray
Commit Name: 6412dfaf383e84e5662cf4bfd3be3927de42e8e1
Time: 2020-12-01
Author: me@barakmich.com
File Name: python/ray/tests/test_experimental_client.py
Class Name:
Method Name: test_nested_function


Project Name: ray-project/ray
Commit Name: 6412dfaf383e84e5662cf4bfd3be3927de42e8e1
Time: 2020-12-01
Author: me@barakmich.com
File Name: python/ray/tests/test_experimental_client.py
Class Name:
Method Name: test_remote_functions