[docs][core] Documentation improvement in master/walkthrough.html (#12473)

This commit is contained in:
Micah Yong
2020-11-28 20:36:01 -08:00
committed by GitHub
parent 8a406e1f9a
commit a537b852e6
+9 -2
View File
@@ -290,6 +290,13 @@ Cancelling tasks
obj_ref = blocking_operation.remote()
ray.cancel(obj_ref)
from ray.exceptions import TaskCancelledError
try:
ray.get(obj_ref)
except TaskCancelledError:
print("Object reference was cancelled.")
.. group-tab:: Java
Task cancellation hasn't been implemented in Java yet.
@@ -354,7 +361,7 @@ If the current node's object store does not contain the object, the object is do
from ray.exceptions import GetTimeoutError
@ray.remote
def long_running_function()
def long_running_function():
time.sleep(8)
obj_ref = long_running_function.remote()
@@ -490,7 +497,7 @@ value.
# Call the actor.
obj_ref = counter.increment.remote()
ray.get(obj_ref) == 1
assert ray.get(obj_ref) == 1
.. code-tab:: java