Skip to content

Conversation

@allenanswerzq
Copy link
Contributor

@allenanswerzq allenanswerzq commented Mar 20, 2020

Why are these changes needed?

Deprecate _remote function.

Related issue number

Closes #7040

Checks

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@allenanswerzq
Copy link
Contributor Author

I think also need to change all tests that are currently use _remote function.

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

@allenanswerzq allenanswerzq changed the title Deprecate _remote function [WIP] Deprecate _remote function Mar 20, 2020
@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/23438/
Test FAILed.

@allenanswerzq allenanswerzq force-pushed the add-deprecation branch 2 times, most recently from 17117be to 9bf28ee Compare March 20, 2020 16:12
@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/23440/
Test FAILed.

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

@allenanswerzq allenanswerzq force-pushed the add-deprecation branch 5 times, most recently from 4459fa8 to 88106dd Compare March 21, 2020 03:50
@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/23476/
Test FAILed.

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

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

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

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

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

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

@allenanswerzq allenanswerzq changed the title [WIP] Deprecate _remote function Deprecate _remote function Mar 21, 2020
@simon-mo simon-mo requested a review from edoakes March 24, 2020 20:33
Copy link
Collaborator

@edoakes edoakes left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! Left a few comments to clean things up some more.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this internal_called flag? Can we just remove all instances of calling this instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, there are mainly two places will call this _remote method, one place is inside the class definition which is good and intended, the other place is outside of the class, we only want to raise a warning message when the latter case happens, thus need this flag to distinguish.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can just get rid of _remote() entirely instead. Looks like .remote() just calls ._remote() directly - we can just move the implementation to .remote() and leave a deprecation error in ._remote()

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

Copy link
Collaborator

@edoakes edoakes left a comment

Choose a reason for hiding this comment

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

I think the docstrings for .options() for both actor classes and remote functions need to be updated to remove the reference to ._remote() as well.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can just get rid of _remote() entirely instead. Looks like .remote() just calls ._remote() directly - we can just move the implementation to .remote() and leave a deprecation error in ._remote()

ray.get(a2.method.remote())

id1, id2, id3, id4 = a.method._remote(
id1, id2, id3, id4 = a.method.remote(
Copy link
Collaborator

Choose a reason for hiding this comment

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

need to change this to use .options().remote()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here a is Actor and the ActorMethod class which a.method is doesn't even have the .options function.

return self._remote(args=args, kwargs=kwargs)
return self._remote(args=args, kwargs=kwargs, internal_called=True)

self.remote = _remote_proxy
Copy link
Contributor Author

@allenanswerzq allenanswerzq Mar 26, 2020

Choose a reason for hiding this comment

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

@edoakes If we remove _remote completely, then this wrapper here that used to keep function's signature also needs to be removed. for detail see #4985. I tried and failed to find a better way to remove the _remote method and also keep the function signature at the same time. Note that we must keep the function signature otherwise it will raise an exception at this place:

ray/python/ray/signature.py

Lines 112 to 118 in 6ce8b63

reconstructed_signature = inspect.Signature(
parameters=signature_parameters)
try:
reconstructed_signature.bind(*args, **kwargs)
except TypeError as exc:
raise TypeError(str(exc))
list_args = []

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.

Deprecate ._remote() and replace all instances with .options() for remote functions and actors.

3 participants