forked from goodboy/tractor
Pack errors from the parent task into the actor nursery
parent
882c33ff06
commit
c437196d9b
|
@ -310,6 +310,7 @@ async def _open_and_supervise_one_cancels_all_nursery(
|
|||
# actors spawned in "daemon mode" (aka started using
|
||||
# ``ActorNursery.start_actor()``).
|
||||
|
||||
err: BaseExpection | None = None
|
||||
# errors from this daemon actor nursery bubble up to caller
|
||||
async with trio.open_nursery() as da_nursery:
|
||||
try:
|
||||
|
@ -348,6 +349,7 @@ async def _open_and_supervise_one_cancels_all_nursery(
|
|||
|
||||
except BaseException as err:
|
||||
|
||||
errors[actor.uid] = err
|
||||
# If we error in the root but the debugger is
|
||||
# engaged we don't want to prematurely kill (and
|
||||
# thus clobber access to) the local tty since it
|
||||
|
@ -383,7 +385,7 @@ async def _open_and_supervise_one_cancels_all_nursery(
|
|||
else:
|
||||
log.exception(
|
||||
f"Nursery for {current_actor().uid} "
|
||||
f"errored with {err}, ")
|
||||
f"errored with")
|
||||
|
||||
# cancel all subactors
|
||||
await anursery.cancel()
|
||||
|
@ -412,6 +414,7 @@ async def _open_and_supervise_one_cancels_all_nursery(
|
|||
|
||||
) as err:
|
||||
|
||||
errors[actor.uid] = err
|
||||
# XXX: yet another guard before allowing the cancel
|
||||
# sequence in case a (single) child is in debug.
|
||||
await maybe_wait_for_debugger(
|
||||
|
|
Loading…
Reference in New Issue