mirror of
https://github.com/wassname/ray.git
synced 2026-07-10 03:14:44 +08:00
Add actor.__ray_kill__() to terminate actors immediately (#6523)
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user