Skip to content

Commit 62be858

Browse files
pablorfb-metafacebook-github-bot
authored andcommitted
Validate errors are propagated through actors (#448)
Summary: Pull Request resolved: #448 Validate errors propagate across chain of actor calls Reviewed By: dulinriley, mariusae Differential Revision: D77767718 fbshipit-source-id: 882af228b169e55bc54fb97b380b405698042a37
1 parent 7e71b3e commit 62be858

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

python/tests/test_actor_error.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,3 +357,32 @@ async def test_proc_mesh_monitoring():
357357
assert isinstance(event, ProcEvent.Crashed)
358358
assert event[0] == 0 # check rank
359359
assert "fail on init" in event[1] # check error message
360+
361+
362+
class Worker(Actor):
363+
@endpoint
364+
def work(self):
365+
raise ValueError("value error")
366+
367+
368+
class Manager(Actor):
369+
@endpoint
370+
async def init(self):
371+
mesh = await proc_mesh(gpus=1)
372+
self.workers = await mesh.spawn("Worker", Worker)
373+
374+
@endpoint
375+
async def route(self):
376+
return await self.workers.work.call_one()
377+
378+
379+
@pytest.mark.asyncio
380+
async def test_errors_propagated():
381+
p_mesh = await proc_mesh(gpus=1)
382+
mesh = await p_mesh.spawn("manager", Manager)
383+
384+
await mesh.init.call_one()
385+
386+
with pytest.raises(ActorError) as err_info:
387+
await mesh.route.call_one()
388+
assert "value error" in str(err_info.value)

0 commit comments

Comments
 (0)