@@ -86,8 +86,6 @@ async def test_choose():
86
86
assert_type (result , int )
87
87
assert result2 == result3
88
88
89
- await proc .stop ()
90
-
91
89
92
90
@pytest .mark .timeout (60 )
93
91
async def test_stream ():
@@ -97,8 +95,6 @@ async def test_stream():
97
95
98
96
assert 8 == sum ([await x for x in v .value .stream ()])
99
97
100
- await proc .stop ()
101
-
102
98
103
99
class To (Actor ):
104
100
@endpoint
@@ -121,8 +117,6 @@ async def test_mesh_passed_to_mesh():
121
117
assert len (all ) == 4
122
118
assert all [0 ] != all [1 ]
123
119
124
- await proc .stop ()
125
-
126
120
127
121
@pytest .mark .timeout (60 )
128
122
async def test_mesh_passed_to_mesh_on_different_proc_mesh ():
@@ -134,9 +128,6 @@ async def test_mesh_passed_to_mesh_on_different_proc_mesh():
134
128
assert len (all ) == 4
135
129
assert all [0 ] != all [1 ]
136
130
137
- await proc .stop ()
138
- await proc2 .stop ()
139
-
140
131
141
132
@pytest .mark .timeout (60 )
142
133
async def test_actor_slicing ():
@@ -153,9 +144,6 @@ async def test_actor_slicing():
153
144
154
145
assert result [0 ] == result [1 ]
155
146
156
- await proc .stop ()
157
- await proc2 .stop ()
158
-
159
147
160
148
@pytest .mark .timeout (60 )
161
149
async def test_aggregate ():
@@ -166,8 +154,6 @@ async def test_aggregate():
166
154
r = await acc .accumulate ()
167
155
assert r == 4
168
156
169
- await proc .stop ()
170
-
171
157
172
158
class RunIt (Actor ):
173
159
@endpoint
@@ -185,8 +171,6 @@ async def test_rank_size():
185
171
assert 1 == await acc .accumulate (lambda : current_rank ()["gpus" ])
186
172
assert 4 == await acc .accumulate (lambda : current_size ()["gpus" ])
187
173
188
- await proc .stop ()
189
-
190
174
191
175
class SyncActor (Actor ):
192
176
@endpoint
@@ -202,51 +186,41 @@ async def test_sync_actor():
202
186
r = await a .sync_endpoint .choose (c )
203
187
assert r == 5
204
188
205
- await proc .stop ()
206
-
207
189
208
190
@pytest .mark .timeout (60 )
209
- async def test_sync_actor_sync_client () -> None :
191
+ def test_sync_actor_sync_client () -> None :
210
192
proc = local_proc_mesh (gpus = 2 )
211
193
a = proc .spawn ("actor" , SyncActor ).get ()
212
194
c = proc .spawn ("counter" , Counter , 5 ).get ()
213
195
r = a .sync_endpoint .choose (c ).get ()
214
196
assert r == 5
215
197
216
- await proc .stop ()
217
-
218
198
219
199
@pytest .mark .timeout (60 )
220
- async def test_proc_mesh_size () -> None :
200
+ def test_proc_mesh_size () -> None :
221
201
proc = local_proc_mesh (gpus = 2 )
222
202
assert 2 == proc .size ("gpus" )
223
- # proc.initialized.get()
224
- # await proc.stop()
225
203
226
204
227
205
@pytest .mark .timeout (60 )
228
- async def test_rank_size_sync () -> None :
206
+ def test_rank_size_sync () -> None :
229
207
proc = local_proc_mesh (gpus = 2 )
230
208
r = proc .spawn ("runit" , RunIt ).get ()
231
209
232
210
acc = Accumulator (r .run , 0 , operator .add )
233
211
assert 1 == acc .accumulate (lambda : current_rank ()["gpus" ]).get ()
234
212
assert 4 == acc .accumulate (lambda : current_size ()["gpus" ]).get ()
235
213
236
- await proc .stop ()
237
-
238
214
239
215
@pytest .mark .timeout (60 )
240
- async def test_accumulate_sync () -> None :
216
+ def test_accumulate_sync () -> None :
241
217
proc = local_proc_mesh (gpus = 2 )
242
218
counter = proc .spawn ("counter" , Counter , 1 ).get ()
243
219
counter .incr .broadcast ()
244
220
acc = Accumulator (counter .value , 0 , operator .add )
245
221
r = acc .accumulate ().get ()
246
222
assert r == 4
247
223
248
- await proc .stop ()
249
-
250
224
251
225
class CastToCounter (Actor ):
252
226
@endpoint
@@ -255,7 +229,7 @@ def doit(self, c: Counter):
255
229
256
230
257
231
@pytest .mark .timeout (60 )
258
- async def test_value_mesh () -> None :
232
+ def test_value_mesh () -> None :
259
233
proc = local_proc_mesh (gpus = 2 )
260
234
counter = proc .spawn ("counter" , Counter , 0 ).get ()
261
235
counter .slice (hosts = 0 , gpus = 1 ).incr .broadcast ()
@@ -266,8 +240,6 @@ async def test_value_mesh() -> None:
266
240
n = proc .spawn ("ctc" , CastToCounter ).get ()
267
241
assert list (x ) == n .slice (gpus = 0 ).doit .call_one (counter ).get ()
268
242
269
- await proc .stop ()
270
-
271
243
272
244
@pytest .mark .timeout (60 )
273
245
def test_rust_binding_modules_correct () -> None :
@@ -334,8 +306,6 @@ async def test_actor_tls() -> None:
334
306
assert 4 == await am .get .call_one ()
335
307
assert 4 == await am .get_async .call_one ()
336
308
337
- await pm .stop ()
338
-
339
309
340
310
class TLSActorFullSync (Actor ):
341
311
"""An actor that manages thread-local state."""
@@ -365,8 +335,6 @@ async def test_actor_tls_full_sync() -> None:
365
335
366
336
assert 4 == await am .get .call_one ()
367
337
368
- await pm .stop ()
369
-
370
338
371
339
class AsyncActor (Actor ):
372
340
def __init__ (self ):
@@ -393,8 +361,6 @@ async def test_async_concurrency():
393
361
await am .no_more .call ()
394
362
await fut
395
363
396
- await pm .stop ()
397
-
398
364
399
365
async def awaitit (f ):
400
366
return await f
@@ -751,7 +717,7 @@ async def send(self, port: Port[int]):
751
717
752
718
753
719
@pytest .mark .timeout (60 )
754
- async def test_port_as_argument ():
720
+ def test_port_as_argument ():
755
721
proc_mesh = local_proc_mesh (gpus = 1 )
756
722
s = proc_mesh .spawn ("send_alot" , SendAlot ).get ()
757
723
mb = Future (coro = proc_mesh ._proc_mesh .task ()).get ().client
@@ -762,8 +728,6 @@ async def test_port_as_argument():
762
728
for i in range (100 ):
763
729
assert i == recv .recv ().get ()
764
730
765
- await proc_mesh .stop ()
766
-
767
731
768
732
@pytest .mark .timeout (15 )
769
733
async def test_same_actor_twice () -> None :
@@ -780,8 +744,6 @@ async def test_same_actor_twice() -> None:
780
744
"gspawn failed: an actor with name 'dup' has already been spawned" in error_msg
781
745
), f"Expected error message about duplicate actor name, got: { error_msg } "
782
746
783
- await pm .stop ()
784
-
785
747
786
748
class TestActorMeshStop (unittest .IsolatedAsyncioTestCase ):
787
749
async def test_actor_mesh_stop (self ) -> None :
@@ -808,13 +770,11 @@ def add(self, port: "Port[int]", b: int) -> None:
808
770
809
771
810
772
@pytest .mark .timeout (60 )
811
- async def test_ported_actor ():
773
+ def test_ported_actor ():
812
774
proc_mesh = local_proc_mesh (gpus = 1 ).get ()
813
775
a = proc_mesh .spawn ("port_actor" , PortedActor ).get ()
814
776
assert 5 == a .add .call_one (2 ).get ()
815
777
816
- await proc_mesh .stop ()
817
-
818
778
819
779
async def _recv ():
820
780
return (7 , 2 , 3 )
0 commit comments