Skip to content

Commit c56b31e

Browse files
samluryemeta-codesync[bot]
authored andcommitted
Prevent PyGILState_Release fatal in test_mesh_len (#1432)
Summary: Pull Request resolved: #1432 As titled ghstack-source-id: 314050405 exported-using-ghexport Reviewed By: zdevito Differential Revision: D83893259 fbshipit-source-id: d0831e193e0b584b88d03c3f3ce7bb07f56b183e
1 parent 89fb29c commit c56b31e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

python/tests/test_python_actors.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,11 +1515,22 @@ def s(t):
15151515
assert r == (0, 1)
15161516

15171517

1518+
class SleepActor(Actor):
1519+
@endpoint
1520+
async def sleep(self, t: float) -> None:
1521+
await asyncio.sleep(t)
1522+
1523+
15181524
@pytest.mark.parametrize("v1", [True, False])
15191525
def test_mesh_len(v1: bool):
15201526
proc_mesh = spawn_procs_on_fake_host(v1, {"gpus": 12})
1521-
s = proc_mesh.spawn("sync_actor", SyncActor)
1527+
s = proc_mesh.spawn("sleep_actor", SleepActor)
15221528
assert 12 == len(s)
1529+
# FIXME: Actually figure out what's going on here.
1530+
# Call an endpoint on the actor before the test
1531+
# exits. Otherwise we might get a fatal PyGILState_Release
1532+
# error.
1533+
s.sleep.call(1).get()
15231534

15241535

15251536
class UndeliverableMessageReceiver(Actor):

0 commit comments

Comments
 (0)