remote is the hook stub passed on to replace `ray.remote`. This sets up remote functions or actors, as the decorator, but does not execute them. Args: *args: opaque arguments; when used as ``@ray.remote`` with no parentheses, contains the wrapped
(self, *args: Any, **kwargs: Any)
| 74 | return self.worker.wait(*args, **kwargs) |
| 75 | |
| 76 | def remote(self, *args: Any, **kwargs: Any): |
| 77 | """remote is the hook stub passed on to replace `ray.remote`. |
| 78 | |
| 79 | This sets up remote functions or actors, as the decorator, |
| 80 | but does not execute them. |
| 81 | |
| 82 | Args: |
| 83 | *args: opaque arguments; when used as ``@ray.remote`` with no |
| 84 | parentheses, contains the wrapped function or class. |
| 85 | **kwargs: opaque keyword arguments; the options forwarded to |
| 86 | ``ray.remote(...)``. |
| 87 | |
| 88 | Returns: |
| 89 | A client-side stub for the remote function or actor, or a |
| 90 | decorator that produces one when applied. |
| 91 | """ |
| 92 | # Delayed import to avoid a cyclic import |
| 93 | from ray.util.client.common import remote_decorator |
| 94 | |
| 95 | if len(args) == 1 and len(kwargs) == 0 and callable(args[0]): |
| 96 | # This is the case where the decorator is just @ray.remote. |
| 97 | return remote_decorator(options=None)(args[0]) |
| 98 | assert ( |
| 99 | len(args) == 0 and len(kwargs) > 0 |
| 100 | ), ray_option_utils.remote_args_error_string |
| 101 | return remote_decorator(options=kwargs) |
| 102 | |
| 103 | # TODO(mwtian): consider adding _internal_ prefix to call_remote / |
| 104 | # call_release / call_retain. |