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