-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Deprecate _remote function #7676
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |||||||||||||||
| from ray import cloudpickle as pickle | ||||||||||||||||
| from ray._raylet import PythonFunctionDescriptor | ||||||||||||||||
| from ray import cross_language, Language | ||||||||||||||||
| from ray.utils import deprecation_warning | ||||||||||||||||
| import ray.signature | ||||||||||||||||
|
|
||||||||||||||||
| # Default parameters for remote functions. | ||||||||||||||||
|
|
@@ -92,7 +93,7 @@ def __init__(self, language, function, function_descriptor, num_cpus, | |||||||||||||||
| # Override task.remote's signature and docstring | ||||||||||||||||
| @wraps(function) | ||||||||||||||||
| def _remote_proxy(*args, **kwargs): | ||||||||||||||||
| return self._remote(args=args, kwargs=kwargs) | ||||||||||||||||
| return self._remote(args=args, kwargs=kwargs, internal_called=True) | ||||||||||||||||
|
|
||||||||||||||||
| self.remote = _remote_proxy | ||||||||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: Lines 112 to 118 in 6ce8b63
|
||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -116,7 +117,8 @@ def _submit(self, | |||||||||||||||
| num_return_vals=num_return_vals, | ||||||||||||||||
| num_cpus=num_cpus, | ||||||||||||||||
| num_gpus=num_gpus, | ||||||||||||||||
| resources=resources) | ||||||||||||||||
| resources=resources, | ||||||||||||||||
| internal_called=True) | ||||||||||||||||
|
|
||||||||||||||||
| def options(self, **options): | ||||||||||||||||
| """Convenience method for executing a task with options. | ||||||||||||||||
|
|
@@ -134,7 +136,8 @@ def options(self, **options): | |||||||||||||||
|
|
||||||||||||||||
| class FuncWrapper: | ||||||||||||||||
| def remote(self, *args, **kwargs): | ||||||||||||||||
| return func_cls._remote(args=args, kwargs=kwargs, **options) | ||||||||||||||||
| return func_cls._remote( | ||||||||||||||||
| args=args, kwargs=kwargs, internal_called=True, **options) | ||||||||||||||||
|
|
||||||||||||||||
| return FuncWrapper() | ||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -148,8 +151,16 @@ def _remote(self, | |||||||||||||||
| memory=None, | ||||||||||||||||
| object_store_memory=None, | ||||||||||||||||
| resources=None, | ||||||||||||||||
| max_retries=None): | ||||||||||||||||
| max_retries=None, | ||||||||||||||||
| internal_called=False): | ||||||||||||||||
|
||||||||||||||||
| """Submit the remote function for execution.""" | ||||||||||||||||
| if not internal_called: | ||||||||||||||||
| # NOTE: We still want this method, we just dont want user to | ||||||||||||||||
| # call this directly outside of this class. In the upcoming | ||||||||||||||||
| # release, simply add `error=True` to this call will raise an | ||||||||||||||||
| # Exception. | ||||||||||||||||
| deprecation_warning("_remote", new=".options") | ||||||||||||||||
|
|
||||||||||||||||
| worker = ray.worker.global_worker | ||||||||||||||||
| worker.check_connected() | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.