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

Print warning when defining very large remote function or actor. #2179

Merged
merged 6 commits into from
Jun 10, 2018
Merged

Print warning when defining very large remote function or actor. #2179

merged 6 commits into from
Jun 10, 2018

Conversation

robertnishihara
Copy link
Collaborator

Print a warning if the user defines a remote function or actor whose serialized form is very large (in this case greater than 10MB). This likely indicates that the function/class definition closes over some large object.

@richardliaw
Copy link
Contributor

Nice this looks decent to me; although we should be printing to stderr rather than stdout (which is a statement applicable to a larger part of the code base :) )

@robertnishihara
Copy link
Collaborator Author

Yes #1884.

@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/5823/
Test PASSed.

@robertnishihara
Copy link
Collaborator Author

Ideally the test would be better and would actually check that the warning is printed using something like https://stackoverflow.com/questions/3892218/how-to-test-with-pythons-unittest-that-a-warning-has-been-thrown.

@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/5831/
Test FAILed.

@robertnishihara
Copy link
Collaborator Author

jenkins, retest this please

@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/5832/
Test FAILed.

@robertnishihara
Copy link
Collaborator Author

jenkins, retest this please

@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/5833/
Test FAILed.

@richardliaw
Copy link
Contributor

Since it's just a print string, you could do something like this: https://stackoverflow.com/questions/4219717/how-to-assert-output-with-nosetest-unittest-in-python

Copy link
Contributor

@richardliaw richardliaw left a comment

Choose a reason for hiding this comment

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

@robertnishihara do you plan on addressing the TODOs? otherwise lgtm

@robertnishihara
Copy link
Collaborator Author

@richardliaw should be fixed now.

@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/5945/
Test PASSed.

Foo.remote()

# Make sure that a warning is generated.
wait_for_errors(b"pickling_large_object", 2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Dumb Question: is this supposed to return an error at some point? Like what happens if this test fails? There's no unittest.assertTrue that raises a notification of failure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, I'll fix that.

large_object

# Make sure that a warning is generated.
wait_for_errors(b"pickling_large_object", 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does wait_for_errors read warnings?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, basically, it reads everything pushed to the error_info queue

"definition uses a large array or other object."
.format(actor_class_info["class_name"],
len(actor_class_info["class"])))
ray.utils.push_error_to_driver(
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if I say redirect_output == True?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It will still be printed in the background on the driver

len(actor_class_info["class"])))
ray.utils.push_error_to_driver(
worker.redis_client,
"pickling_large_object",
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be a constant somewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes it should be. I partially addressed this. However, this should really be done in flatbuffers.

Copy link
Contributor

@richardliaw richardliaw left a comment

Choose a reason for hiding this comment

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

overall looks fine.

import ray.test.test_functions as test_functions

if sys.version_info >= (3, 0):
from importlib import reload


def relevant_errors(error_type):
return [info for info in ray.error_info() if info[b"type"] == error_type]
Copy link
Contributor

Choose a reason for hiding this comment

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

does the b no longer matter?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Due to https://github.com/ray-project/ray/pull/2179/files#diff-8165ed4a37603e0f7e2eaf79e3a69bf7R1166, the error_info information consists of string instead of byte objects.

@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/5971/
Test PASSed.

@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/5973/
Test PASSed.

@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/5974/
Test PASSed.

@pcmoritz pcmoritz merged commit 125fe1c into ray-project:master Jun 10, 2018
@pcmoritz pcmoritz deleted the largepicklewarnings branch June 10, 2018 02:59
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