From 2db03444f75c880e485d720d6205ef12abf3c889 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 28 May 2024 16:03:36 -0400 Subject: [PATCH] Don't (noisly) log about runtime cancel RPC tasks Since in the case of the `Actor._cancel_task()` related runtime eps we actually don't EVER register them in `Actor._rpc_tasks`.. logging about them is just needless noise, though maybe we should track them in a diff table; something like a `._runtime_rpc_tasks`? Drop the cancel-request-for-stale-RPC-task (`KeyError` case in `Actor._cancel_task()`) log-emit level in to `.runtime()`; it's generally not useful info other then for granular race condition eval when hacking the runtime. --- tractor/_rpc.py | 18 ++++++++++++------ tractor/_runtime.py | 7 ++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/tractor/_rpc.py b/tractor/_rpc.py index 9b92d4e..f05a433 100644 --- a/tractor/_rpc.py +++ b/tractor/_rpc.py @@ -397,12 +397,18 @@ async def _errors_relayed_via_ipc( f'|_{ctx._task}\n' f' >> {ctx.repr_rpc}\n' ) - else: - log.cancel( - 'Failed to de-alloc internal runtime cancel task?\n' - f'|_{ctx._task}\n' - f' >> {ctx.repr_rpc}\n' - ) + # TODO: remove this right? rn the only non-`is_rpc` cases + # are cancellation methods and according the RPC loop eps + # for thoses below, nothing is ever registered in + # `Actor._rpc_tasks` for those cases.. but should we? + # + # -[ ] maybe we should have an equiv `Actor._runtime_rpc_tasks`? + # else: + # log.cancel( + # 'Failed to de-alloc internal runtime cancel task?\n' + # f'|_{ctx._task}\n' + # f' >> {ctx.repr_rpc}\n' + # ) finally: if not actor._rpc_tasks: diff --git a/tractor/_runtime.py b/tractor/_runtime.py index 1f81c74..99a969b 100644 --- a/tractor/_runtime.py +++ b/tractor/_runtime.py @@ -1256,9 +1256,10 @@ class Actor: # - child returns a result before cancel-msg/ctxc-raised # - child self raises ctxc before parent send request, # - child errors prior to cancel req. - log.cancel( - 'Cancel request invalid, RPC task already completed?\n\n' - f'<= canceller: {requesting_uid}\n\n' + log.runtime( + 'Cancel request for invalid RPC task.\n' + 'The task likely already completed or was never started!\n\n' + f'<= canceller: {requesting_uid}\n' f'=> {cid}@{parent_chan.uid}\n' f' |_{parent_chan}\n' )