def remote(self, *args, **kwargs): """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 kwargs: opaque keyword arguments """ # Delayed import to avoid a cyclic import from ray.util.client.common import remote_decorator if len(args) == 1 and len(kwargs) == 0 and callable(args[0]): # This is the case where the decorator is just @ray.remote. return remote_decorator(options=None)(args[0]) error_string = ( "The @ray.remote decorator must be applied either " "with no arguments and no parentheses, for example " "'@ray.remote', or it must be applied using some of " "the arguments 'num_returns', 'num_cpus', 'num_gpus', " "'memory', 'object_store_memory', 'resources', " "'max_calls', or 'max_restarts', like " "'@ray.remote(num_returns=2, " 'resources={"CustomResource": 1})\'.' ) assert len(args) == 0 and len(kwargs) > 0, error_string return remote_decorator(options=kwargs)
def remote(self, *args, **kwargs): """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 kwargs: opaque keyword arguments """ # Delayed import to avoid a cyclic import from ray.util.client.common import remote_decorator if len(args) == 1 and len(kwargs) == 0 and callable(args[0]): # This is the case where the decorator is just @ray.remote. return remote_decorator(options=None)(args[0]) assert (len(args) == 0 and len(kwargs) > 0), ray_option_utils.remote_args_error_string return remote_decorator(options=kwargs)