Skip to content

Commit 308b5fd

Browse files
committed
Back out "fix broken tests"
Pull Request resolved: #751 Checks to see if the fix below this in the stack actually works. ghstack-source-id: 300893831 Differential Revision: [D79586849](https://our.internmc.facebook.com/intern/diff/D79586849/)
1 parent 6f7b68c commit 308b5fd

File tree

1 file changed

+7
-47
lines changed

1 file changed

+7
-47
lines changed

python/tests/test_python_actors.py

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ async def test_choose():
8686
assert_type(result, int)
8787
assert result2 == result3
8888

89-
await proc.stop()
90-
9189

9290
@pytest.mark.timeout(60)
9391
async def test_stream():
@@ -97,8 +95,6 @@ async def test_stream():
9795

9896
assert 8 == sum([await x for x in v.value.stream()])
9997

100-
await proc.stop()
101-
10298

10399
class To(Actor):
104100
@endpoint
@@ -121,8 +117,6 @@ async def test_mesh_passed_to_mesh():
121117
assert len(all) == 4
122118
assert all[0] != all[1]
123119

124-
await proc.stop()
125-
126120

127121
@pytest.mark.timeout(60)
128122
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():
134128
assert len(all) == 4
135129
assert all[0] != all[1]
136130

137-
await proc.stop()
138-
await proc2.stop()
139-
140131

141132
@pytest.mark.timeout(60)
142133
async def test_actor_slicing():
@@ -153,9 +144,6 @@ async def test_actor_slicing():
153144

154145
assert result[0] == result[1]
155146

156-
await proc.stop()
157-
await proc2.stop()
158-
159147

160148
@pytest.mark.timeout(60)
161149
async def test_aggregate():
@@ -166,8 +154,6 @@ async def test_aggregate():
166154
r = await acc.accumulate()
167155
assert r == 4
168156

169-
await proc.stop()
170-
171157

172158
class RunIt(Actor):
173159
@endpoint
@@ -185,8 +171,6 @@ async def test_rank_size():
185171
assert 1 == await acc.accumulate(lambda: current_rank()["gpus"])
186172
assert 4 == await acc.accumulate(lambda: current_size()["gpus"])
187173

188-
await proc.stop()
189-
190174

191175
class SyncActor(Actor):
192176
@endpoint
@@ -202,51 +186,41 @@ async def test_sync_actor():
202186
r = await a.sync_endpoint.choose(c)
203187
assert r == 5
204188

205-
await proc.stop()
206-
207189

208190
@pytest.mark.timeout(60)
209-
async def test_sync_actor_sync_client() -> None:
191+
def test_sync_actor_sync_client() -> None:
210192
proc = local_proc_mesh(gpus=2)
211193
a = proc.spawn("actor", SyncActor).get()
212194
c = proc.spawn("counter", Counter, 5).get()
213195
r = a.sync_endpoint.choose(c).get()
214196
assert r == 5
215197

216-
await proc.stop()
217-
218198

219199
@pytest.mark.timeout(60)
220-
async def test_proc_mesh_size() -> None:
200+
def test_proc_mesh_size() -> None:
221201
proc = local_proc_mesh(gpus=2)
222202
assert 2 == proc.size("gpus")
223-
# proc.initialized.get()
224-
# await proc.stop()
225203

226204

227205
@pytest.mark.timeout(60)
228-
async def test_rank_size_sync() -> None:
206+
def test_rank_size_sync() -> None:
229207
proc = local_proc_mesh(gpus=2)
230208
r = proc.spawn("runit", RunIt).get()
231209

232210
acc = Accumulator(r.run, 0, operator.add)
233211
assert 1 == acc.accumulate(lambda: current_rank()["gpus"]).get()
234212
assert 4 == acc.accumulate(lambda: current_size()["gpus"]).get()
235213

236-
await proc.stop()
237-
238214

239215
@pytest.mark.timeout(60)
240-
async def test_accumulate_sync() -> None:
216+
def test_accumulate_sync() -> None:
241217
proc = local_proc_mesh(gpus=2)
242218
counter = proc.spawn("counter", Counter, 1).get()
243219
counter.incr.broadcast()
244220
acc = Accumulator(counter.value, 0, operator.add)
245221
r = acc.accumulate().get()
246222
assert r == 4
247223

248-
await proc.stop()
249-
250224

251225
class CastToCounter(Actor):
252226
@endpoint
@@ -255,7 +229,7 @@ def doit(self, c: Counter):
255229

256230

257231
@pytest.mark.timeout(60)
258-
async def test_value_mesh() -> None:
232+
def test_value_mesh() -> None:
259233
proc = local_proc_mesh(gpus=2)
260234
counter = proc.spawn("counter", Counter, 0).get()
261235
counter.slice(hosts=0, gpus=1).incr.broadcast()
@@ -266,8 +240,6 @@ async def test_value_mesh() -> None:
266240
n = proc.spawn("ctc", CastToCounter).get()
267241
assert list(x) == n.slice(gpus=0).doit.call_one(counter).get()
268242

269-
await proc.stop()
270-
271243

272244
@pytest.mark.timeout(60)
273245
def test_rust_binding_modules_correct() -> None:
@@ -334,8 +306,6 @@ async def test_actor_tls() -> None:
334306
assert 4 == await am.get.call_one()
335307
assert 4 == await am.get_async.call_one()
336308

337-
await pm.stop()
338-
339309

340310
class TLSActorFullSync(Actor):
341311
"""An actor that manages thread-local state."""
@@ -365,8 +335,6 @@ async def test_actor_tls_full_sync() -> None:
365335

366336
assert 4 == await am.get.call_one()
367337

368-
await pm.stop()
369-
370338

371339
class AsyncActor(Actor):
372340
def __init__(self):
@@ -393,8 +361,6 @@ async def test_async_concurrency():
393361
await am.no_more.call()
394362
await fut
395363

396-
await pm.stop()
397-
398364

399365
async def awaitit(f):
400366
return await f
@@ -751,7 +717,7 @@ async def send(self, port: Port[int]):
751717

752718

753719
@pytest.mark.timeout(60)
754-
async def test_port_as_argument():
720+
def test_port_as_argument():
755721
proc_mesh = local_proc_mesh(gpus=1)
756722
s = proc_mesh.spawn("send_alot", SendAlot).get()
757723
mb = Future(coro=proc_mesh._proc_mesh.task()).get().client
@@ -762,8 +728,6 @@ async def test_port_as_argument():
762728
for i in range(100):
763729
assert i == recv.recv().get()
764730

765-
await proc_mesh.stop()
766-
767731

768732
@pytest.mark.timeout(15)
769733
async def test_same_actor_twice() -> None:
@@ -780,8 +744,6 @@ async def test_same_actor_twice() -> None:
780744
"gspawn failed: an actor with name 'dup' has already been spawned" in error_msg
781745
), f"Expected error message about duplicate actor name, got: {error_msg}"
782746

783-
await pm.stop()
784-
785747

786748
class TestActorMeshStop(unittest.IsolatedAsyncioTestCase):
787749
async def test_actor_mesh_stop(self) -> None:
@@ -808,13 +770,11 @@ def add(self, port: "Port[int]", b: int) -> None:
808770

809771

810772
@pytest.mark.timeout(60)
811-
async def test_ported_actor():
773+
def test_ported_actor():
812774
proc_mesh = local_proc_mesh(gpus=1).get()
813775
a = proc_mesh.spawn("port_actor", PortedActor).get()
814776
assert 5 == a.add.call_one(2).get()
815777

816-
await proc_mesh.stop()
817-
818778

819779
async def _recv():
820780
return (7, 2, 3)

0 commit comments

Comments
 (0)