Add actor.__ray_kill__() to terminate actors immediately (#6523)

This commit is contained in:
Edward Oakes
2019-12-23 23:12:57 -06:00
committed by GitHub
parent 49b0ebf724
commit 6b1a57542e
12 changed files with 173 additions and 5 deletions
+22
View File
@@ -1746,6 +1746,28 @@ def remote(*args, **kwargs):
class Foo(object):
def method(self):
return 1
Remote task and actor objects returned by @ray.remote can also be
dynamically modified with the same arguments as above using
``.options()`` as follows:
.. code-block:: python
@ray.remote(num_gpus=1, max_calls=1, num_return_vals=2)
def f():
return 1, 2
g = f.options(num_gpus=2, max_calls=None)
@ray.remote(num_cpus=2, resources={"CustomResource": 1})
class Foo(object):
def method(self):
return 1
Bar = Foo.options(num_cpus=1, resources=None)
Running remote actors will be terminated when the actor handle to them
in Python is deleted, which will cause them to complete any outstanding
work and then shut down. If you want to kill them immediately, you can
also call ``actor_handle.__ray_kill__()``.
"""
worker = get_global_worker()