def decorator(function_or_class) -> ClientStub: if (inspect.isfunction(function_or_class) or is_cython(function_or_class)): return ClientRemoteFunc(function_or_class, options=options) elif inspect.isclass(function_or_class): return ClientActorClass(function_or_class, options=options) else: raise TypeError("The @ray.remote decorator must be applied to " "either a function or to a class.")
def remote(self, function_or_class, *args, **kwargs): # TODO(barakmich): Arguments to ray.remote # get captured here. if (inspect.isfunction(function_or_class) or is_cython(function_or_class)): return ClientRemoteFunc(function_or_class) elif inspect.isclass(function_or_class): return ClientActorClass(function_or_class) else: raise TypeError("The @ray.remote decorator must be applied to " "either a function or to a class.")
def call_remote(self, f: ClientRemoteFunc, *args, **kwargs): if f._raylet_remote_func is None: f._raylet_remote_func = ray.remote(f._func) return f._raylet_remote_func.remote(*args, **kwargs)
def remote(self, func): return ClientRemoteFunc(func)