Skip to content

Conversation

@surehb
Copy link

@surehb surehb commented Jul 24, 2018

What do these changes do?

Add test for PR: Use different serialization context for each driver..

Related issue number

#2406

@surehb
Copy link
Author

surehb commented Jul 24, 2018

@robertnishihara, please take a look. Thanks.

@AmplabJenkins
Copy link

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

ray.shutdown()

def testRunDriverForTwice(self):
# We used to have issue 2165 and 2288: driver will hang when we run it
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you include the full URL instead of just the issue number? This will make it easier to navigate to the issue.

Copy link
Author

Choose a reason for hiding this comment

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

OK.

def tearDown(self):
ray.shutdown()

def testRunDriverForTwice(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd suggest changing this test to not use Ray tune (since the implementation of Ray tune may change). Instead, I'd consider doing something like the following

driver1 = """
...
def serializer(obj):
    return 1

def deserializer(serialized_obj):
    assert serialized_obj == 1
    return 1

class Foo(object):
    pass

ray.register_custom_serializer(serializer=serializer, deserializer=deserializer)

@ray.remote
def f(x):
    assert x == 1
    return Foo()

for _ in range(10):
    time.sleep(0.1)
    assert ray.get([f.remote() for _ in range(10)]) == 1
"""

In driver2 all of the 1s should be replaced by 2.

I'd make num_cpus=1 so that all tasks run on the same worker.

This is just an example, but I think it isolates the lower-level behavior a little more clearly. What do you think?

Also, please make sure that the test fails without the patch.

Copy link
Author

Choose a reason for hiding this comment

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

I would prefer the existing way since:

  1. What this test covers is whether we can run a driver for twice successfully, I believe we will need this kind of test sooner or later;
  2. Ray tune is the typical case that used to run into problem, it makes more sense to use it to test the fix for this case;
  3. I understand that the current test is more like a E2E test, and what you propose is more like unit test. I agree that it will be better for us to have completed unit test, for example we need to test: type register on worker -> verify driver and other workers; type register on driver -> verify all workers. I can do it later.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, I think having a unit test at some point would be valuable, but I agree that this test makes sense.


for i in range(2):
out = run_string_as_driver(driver_script)
self.assertIn("success", out)
Copy link
Collaborator

Choose a reason for hiding this comment

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

How long does this test take to run? If it's quick then maybe we want both.

Copy link
Author

Choose a reason for hiding this comment

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

It runs about 10 seconds, what do you mean by "both"?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I meant "this test" and "the unit test I proposed above."

Anyway, 10 seconds is on the long side. It's ok in this case, but in general we should keep tests as short as possible.

@surehb surehb force-pushed the RunDriverTwiceTest branch from b9d844b to 8e999f3 Compare July 25, 2018 06:28
@surehb
Copy link
Author

surehb commented Jul 25, 2018

Thank you @robertnishihara!

@AmplabJenkins
Copy link

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

@surehb
Copy link
Author

surehb commented Jul 26, 2018

@robertnishihara, can you help to merge? Thank you!

@robertnishihara robertnishihara merged commit 29451cc into ray-project:master Jul 27, 2018
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.

4 participants