Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions python/ray/tests/test_cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,29 +458,32 @@ def remote_wait(sg):

@pytest.mark.parametrize("use_force", [True, False])
def test_recursive_cancel(shutdown_only, use_force):
ray.init(num_cpus=4)
ray.init(num_cpus=2)

@ray.remote(num_cpus=1)
def inner():
def inner(signal_actor):
signal_actor.send.remote()
while True:
time.sleep(0.1)

@ray.remote(num_cpus=1)
def outer():
x = [inner.remote()]
print(x)
def outer(signal_actor):
_ = inner.remote(signal_actor)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to assign

while True:
time.sleep(0.1)

@ray.remote(num_cpus=4)
@ray.remote(num_cpus=2)
def many_resources():
return 300
return True

outer_fut = outer.remote()
signal_actor = SignalActor.remote()
outer_fut = outer.remote(signal_actor)
# Wait until both inner and outer are running
ray.get(signal_actor.wait.remote())
many_fut = many_resources.remote()
with pytest.raises(GetTimeoutError):
ray.get(many_fut, timeout=1)
ray.cancel(outer_fut)
ray.cancel(outer_fut, force=use_force)
with pytest.raises(valid_exceptions(use_force)):
ray.get(outer_fut, timeout=10)

Expand Down