Support concurrent Actor calls in Ray (#6053)

This commit is contained in:
Eric Liang
2019-11-04 01:14:35 -08:00
committed by GitHub
parent fbad6f543b
commit 8485304e83
21 changed files with 287 additions and 86 deletions
+20
View File
@@ -110,6 +110,26 @@ class RemoteFunction(object):
num_gpus=num_gpus,
resources=resources)
def options(self, **options):
"""Convenience method for executing a task with options.
Same arguments as func._remote(), but returns a wrapped function
that a non-underscore .remote() can be called on.
Examples:
# The following two calls are equivalent.
>>> func._remote(num_cpus=4, args=[x, y])
>>> func.options(num_cpus=4).remote(x, y)
"""
func_cls = self
class FuncWrapper(object):
def remote(self, *args, **kwargs):
return func_cls._remote(args=args, kwargs=kwargs, **options)
return FuncWrapper()
def _remote(self,
args=None,
kwargs=None,