mirror of
https://github.com/wassname/ray.git
synced 2026-07-13 11:45:08 +08:00
[docs][core] Documentation improvement in master/walkthrough.html (#12473)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user