From f56b3be916559977c1390e227b0154e31c42ffe4 Mon Sep 17 00:00:00 2001 From: Ian Rodney Date: Wed, 20 May 2020 10:31:57 -0700 Subject: [PATCH] [Docs] Add Cancelation to main docs. (#8508) * Update walkthrough.rst * Adding example * Better example * Better example * Adding Ray Kill Info --- doc/source/walkthrough.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/source/walkthrough.rst b/doc/source/walkthrough.rst index dc6e7d070..f39f3604b 100644 --- a/doc/source/walkthrough.rst +++ b/doc/source/walkthrough.rst @@ -168,6 +168,20 @@ Further, remote functions can return multiple object IDs. a_id, b_id, c_id = return_multiple.remote() +Remote functions can be canceled by calling ``ray.cancel`` on the returned Object ID. Remote actor functions can be stopped by killing the actor using the ``ray.kill`` interface. + +.. code-block:: python + + @ray.remote + def blocking_operation(): + time.sleep(10e6) + return 100 + + obj_id = blocking_operation.remote() + ray.cancel(obj_id) + +.. autofunction:: ray.cancel + :noindex: Objects in Ray --------------