File tree Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change 1
1
import pytest
2
2
import os
3
3
import sys
4
+ import time
4
5
5
6
import ray
6
7
import ray .cluster_utils
@@ -32,9 +33,7 @@ def validate(runtime_env_dict: dict) -> str:
32
33
33
34
@staticmethod
34
35
def create (uri : str , runtime_env_dict : dict , ctx : RuntimeEnvContext ) -> float :
35
- import time
36
-
37
- time .sleep (15 )
36
+ time .sleep (60 )
38
37
return 0
39
38
40
39
@@ -142,14 +141,14 @@ def test_remove_placement_group_worker_startup_slowly(
142
141
143
142
@ray .remote (num_cpus = 2 )
144
143
class A :
145
- def f (self ):
146
- return 3
144
+ def ready (self ):
145
+ return "ok"
146
+
147
+ def hang (self ):
148
+ time .sleep (60 )
147
149
148
150
@ray .remote (num_cpus = 2 , max_retries = 0 )
149
151
def long_running_task ():
150
- print (os .getpid ())
151
- import time
152
-
153
152
time .sleep (60 )
154
153
155
154
# Schedule a long-running task that uses
@@ -165,15 +164,13 @@ def long_running_task():
165
164
placement_group = placement_group
166
165
)
167
166
).remote ()
168
- assert ray .get (a .f .remote ()) == 3
167
+ assert ray .get (a .ready .remote ()) == "ok"
169
168
169
+ # Remove the PG, check that the actor and task are failed.
170
170
ray .util .remove_placement_group (placement_group )
171
171
172
- # Make sure the actor has been killed
173
- # because of the removal of the pg.
174
- # TODO(@clay4444): Make it throw a `ActorPlacementGroupRemoved`.
175
172
with pytest .raises (ray .exceptions .RayActorError , match = "actor died" ):
176
- ray .get (a .f .remote (), timeout = 3.0 )
173
+ ray .get (a .hang .remote (), timeout = 10 )
177
174
178
175
# The long-running task should still be in the state
179
176
# of leasing-worker bacause of the worker startup delay.
You can’t perform that action at this time.
0 commit comments