Compare commits
	
		
			4 Commits 
		
	
	
		
			4bc443ccae
			...
			af3c14b250
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								 | 
						af3c14b250 | |
| 
							
							
								 | 
						7de7fd0afd | |
| 
							
							
								 | 
						79888a31a4 | |
| 
							
							
								 | 
						de16a9ac6f | 
| 
						 | 
				
			
			@ -410,7 +410,6 @@ def test_peer_canceller(
 | 
			
		|||
    '''
 | 
			
		||||
    async def main():
 | 
			
		||||
        async with tractor.open_nursery(
 | 
			
		||||
            # NOTE: to halt the peer tasks on ctxc, uncomment this.
 | 
			
		||||
            debug_mode=debug_mode,
 | 
			
		||||
        ) as an:
 | 
			
		||||
            canceller: Portal = await an.start_actor(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -238,7 +238,8 @@ def enable_stack_on_sig(
 | 
			
		|||
        import stackscope
 | 
			
		||||
    except ImportError:
 | 
			
		||||
        log.error(
 | 
			
		||||
            '`stackscope` not installed for use in debug mode!'
 | 
			
		||||
            '`stackscope` not installed for use in debug mode!\n'
 | 
			
		||||
            '`Ignoring {enable_stack_on_sig!r} call!\n'
 | 
			
		||||
        )
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -143,7 +143,7 @@ async def maybe_wait_on_canced_subs(
 | 
			
		|||
        log.cancel(
 | 
			
		||||
            'Waiting on cancel request to peer..\n'
 | 
			
		||||
            f'c)=>\n'
 | 
			
		||||
            f'  |_{chan.uid}\n'
 | 
			
		||||
            f'  |_{chan.aid}\n'
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        # XXX: this is a soft wait on the channel (and its
 | 
			
		||||
| 
						 | 
				
			
			@ -156,7 +156,7 @@ async def maybe_wait_on_canced_subs(
 | 
			
		|||
        # local runtime here is now cancelled while
 | 
			
		||||
        # (presumably) in the middle of msg loop processing.
 | 
			
		||||
        chan_info: str = (
 | 
			
		||||
            f'{chan.uid}\n'
 | 
			
		||||
            f'{chan.aid}\n'
 | 
			
		||||
            f'|_{chan}\n'
 | 
			
		||||
            f'  |_{chan.transport}\n\n'
 | 
			
		||||
        )
 | 
			
		||||
| 
						 | 
				
			
			@ -279,7 +279,7 @@ async def maybe_wait_on_canced_subs(
 | 
			
		|||
                    log.runtime(
 | 
			
		||||
                        f'Peer IPC broke but subproc is alive?\n\n'
 | 
			
		||||
 | 
			
		||||
                        f'<=x {chan.uid}@{chan.raddr}\n'
 | 
			
		||||
                        f'<=x {chan.aid}@{chan.raddr}\n'
 | 
			
		||||
                        f'   |_{proc}\n'
 | 
			
		||||
                    )
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -460,7 +460,7 @@ async def handle_stream_from_peer(
 | 
			
		|||
        # drop ref to channel so it can be gc-ed and disconnected
 | 
			
		||||
        con_teardown_status: str = (
 | 
			
		||||
            f'IPC channel disconnected:\n'
 | 
			
		||||
            f'<=x uid: {chan.uid}\n'
 | 
			
		||||
            f'<=x uid: {chan.aid}\n'
 | 
			
		||||
            f'   |_{pformat(chan)}\n\n'
 | 
			
		||||
        )
 | 
			
		||||
        chans.remove(chan)
 | 
			
		||||
| 
						 | 
				
			
			@ -468,7 +468,7 @@ async def handle_stream_from_peer(
 | 
			
		|||
        # TODO: do we need to be this pedantic?
 | 
			
		||||
        if not chans:
 | 
			
		||||
            con_teardown_status += (
 | 
			
		||||
                f'-> No more channels with {chan.uid}'
 | 
			
		||||
                f'-> No more channels with {chan.aid}'
 | 
			
		||||
            )
 | 
			
		||||
            server._peers.pop(uid, None)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -519,7 +519,7 @@ async def handle_stream_from_peer(
 | 
			
		|||
                    and
 | 
			
		||||
                    (ctx_in_debug := pdb_lock.ctx_in_debug)
 | 
			
		||||
                    and
 | 
			
		||||
                    (pdb_user_uid := ctx_in_debug.chan.uid)
 | 
			
		||||
                    (pdb_user_uid := ctx_in_debug.chan.aid)
 | 
			
		||||
                ):
 | 
			
		||||
                    entry: tuple|None = local_nursery._children.get(
 | 
			
		||||
                        tuple(pdb_user_uid)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,7 +40,7 @@ from typing import (
 | 
			
		|||
import trio
 | 
			
		||||
from tractor._state import current_actor
 | 
			
		||||
from tractor.log import get_logger
 | 
			
		||||
# from ._beg import collapse_eg
 | 
			
		||||
from ._beg import collapse_eg
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if TYPE_CHECKING:
 | 
			
		||||
| 
						 | 
				
			
			@ -151,13 +151,8 @@ async def gather_contexts(
 | 
			
		|||
        )
 | 
			
		||||
 | 
			
		||||
    async with (
 | 
			
		||||
        # collapse_eg(),
 | 
			
		||||
        trio.open_nursery(
 | 
			
		||||
            # strict_exception_groups=False,
 | 
			
		||||
            # ^XXX^ TODO? soo roll our own then ??
 | 
			
		||||
            # -> since we kinda want the "if only one `.exception` then
 | 
			
		||||
            # just raise that" interface?
 | 
			
		||||
        ) as tn,
 | 
			
		||||
        collapse_eg(),
 | 
			
		||||
        trio.open_nursery() as tn,
 | 
			
		||||
    ):
 | 
			
		||||
        for mngr in mngrs:
 | 
			
		||||
            tn.start_soon(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue