From 2733c78eb86f762cf34a642f62f82434cf856eec Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 26 Feb 2025 13:16:15 -0500 Subject: [PATCH] Log format tweaks for sclang reprs A space here, a newline there.. --- tractor/_context.py | 5 +++-- tractor/_entry.py | 2 +- tractor/_rpc.py | 4 ++-- tractor/_runtime.py | 7 +++++-- tractor/_spawn.py | 7 ++++--- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/tractor/_context.py b/tractor/_context.py index 8c65b5a..2dad8b2 100644 --- a/tractor/_context.py +++ b/tractor/_context.py @@ -950,7 +950,7 @@ class Context: # f'Context.cancel() => {self.chan.uid}\n' f'c)=> {self.chan.uid}\n' # f'{self.chan.uid}\n' - f' |_ @{self.dst_maddr}\n' + f' |_ @{self.dst_maddr}\n' f' >> {self.repr_rpc}\n' # f' >> {self._nsf}() -> {codec}[dict]:\n\n' # TODO: pull msg-type from spec re #320 @@ -1003,7 +1003,8 @@ class Context: ) else: log.cancel( - 'Timed out on cancel request of remote task?\n' + f'Timed out on cancel request of remote task?\n' + f'\n' f'{reminfo}' ) diff --git a/tractor/_entry.py b/tractor/_entry.py index 19dcb9f..8156d25 100644 --- a/tractor/_entry.py +++ b/tractor/_entry.py @@ -238,7 +238,7 @@ def _trio_main( nest_from_op( input_op='>(', # see syntax ideas above tree_str=actor_info, - back_from_op=1, + back_from_op=2, # since "complete" ) ) logmeth = log.info diff --git a/tractor/_rpc.py b/tractor/_rpc.py index 1f34c23..c2240f2 100644 --- a/tractor/_rpc.py +++ b/tractor/_rpc.py @@ -852,8 +852,8 @@ async def try_ship_error_to_remote( log.critical( 'IPC transport failure -> ' f'failed to ship error to {remote_descr}!\n\n' - f'X=> {channel.uid}\n\n' - + f'{type(msg)!r}[{msg.boxed_type}] X=> {channel.uid}\n' + f'\n' # TODO: use `.msg.preetty_struct` for this! f'{msg}\n' ) diff --git a/tractor/_runtime.py b/tractor/_runtime.py index d734530..15889a2 100644 --- a/tractor/_runtime.py +++ b/tractor/_runtime.py @@ -1287,7 +1287,8 @@ class Actor: msg: str = ( f'Actor-runtime cancel request from {requester_type}\n\n' f'<=c) {requesting_uid}\n' - f' |_{self}\n' + f' |_{self}\n' + f'\n' ) # TODO: what happens here when we self-cancel tho? @@ -1307,13 +1308,15 @@ class Actor: lock_req_ctx.has_outcome ): msg += ( - '-> Cancelling active debugger request..\n' + f'\n' + f'-> Cancelling active debugger request..\n' f'|_{_debug.Lock.repr()}\n\n' f'|_{lock_req_ctx}\n\n' ) # lock_req_ctx._scope.cancel() # TODO: wrap this in a method-API.. debug_req.req_cs.cancel() + # if lock_req_ctx: # self-cancel **all** ongoing RPC tasks await self.cancel_rpc_tasks( diff --git a/tractor/_spawn.py b/tractor/_spawn.py index 2c0f8fa..84010c1 100644 --- a/tractor/_spawn.py +++ b/tractor/_spawn.py @@ -323,9 +323,10 @@ async def soft_kill( uid: tuple[str, str] = portal.channel.uid try: log.cancel( - 'Soft killing sub-actor via portal request\n' - f'c)> {portal.chan.uid}\n' - f' |_{proc}\n' + f'Soft killing sub-actor via portal request\n' + f'\n' + f'(c=> {portal.chan.uid}\n' + f' |_{proc}\n' ) # wait on sub-proc to signal termination await wait_func(proc)