forked from goodboy/tractor
1
0
Fork 0

`._entry`: use same msg info in start/terminate log

modden_spawn_from_client_req
Tyler Goodlet 2024-03-05 12:30:09 -05:00
parent c6b4da5788
commit e536057fea
2 changed files with 17 additions and 5 deletions

View File

@ -116,14 +116,18 @@ def _trio_main(
if actor.loglevel is not None:
get_console_log(actor.loglevel)
import os
log.info(
'Started new trio process:\n'
actor_info: str = (
f'|_{actor}\n'
f' uid: {actor.uid}\n'
f' pid: {os.getpid()}\n'
f' parent_addr: {parent_addr}\n'
f' loglevel: {actor.loglevel}\n'
)
log.info(
'Started new trio process:\n'
+
actor_info
)
try:
if infect_asyncio:
@ -133,8 +137,14 @@ def _trio_main(
trio.run(trio_main)
except KeyboardInterrupt:
log.cancel(
f'@{actor.uid} received KBI'
'Actor received KBI\n'
+
actor_info
)
finally:
log.info(f"Actor {actor.uid} terminated")
log.info(
'Actor terminated\n'
+
actor_info
)

View File

@ -342,7 +342,9 @@ async def open_root_actor(
# for an in nurseries:
# tempn.start_soon(an.exited.wait)
logger.cancel("Shutting down root actor")
logger.info(
'Closing down root actor'
)
await actor.cancel(None) # self cancel
finally:
_state._current_actor = None