Log on KBI cancelled termination

ensure_deregister
Tyler Goodlet 2020-08-03 18:46:18 -04:00
parent a24c6bfdd2
commit ae9016c06a
2 changed files with 7 additions and 3 deletions

View File

@ -23,6 +23,7 @@ async def get_arbiter(
arbiter.
"""
actor = current_actor()
if not actor:
raise RuntimeError("No actor instance has been defined yet?")
@ -38,7 +39,8 @@ async def get_arbiter(
@asynccontextmanager
async def find_actor(
name: str, arbiter_sockaddr: Tuple[str, int] = None
name: str,
arbiter_sockaddr: Tuple[str, int] = None
) -> typing.AsyncGenerator[Optional[Portal], None]:
"""Ask the arbiter to find actor(s) by name.

View File

@ -72,8 +72,10 @@ def _trio_main(
actor._async_main,
parent_addr=parent_addr
)
try:
trio.run(trio_main)
except KeyboardInterrupt:
pass # handle it the same way trio does?
log.info(f"Actor {actor.uid} terminated")
log.warning(f"Actor {actor.uid} received KBI")
log.info(f"Actor {actor.uid} terminated")