示例#1
0
文件: worker.py 项目: roclark/ray
 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.")
示例#2
0
文件: worker.py 项目: tseiger1/ray
 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.")
示例#3
0
 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)
示例#4
0
 def remote(self, func):
     return ClientRemoteFunc(func)