forked from goodboy/tractor
`._entry`: use same msg info in start/terminate log
parent
c6b4da5788
commit
e536057fea
|
@ -116,14 +116,18 @@ def _trio_main(
|
||||||
if actor.loglevel is not None:
|
if actor.loglevel is not None:
|
||||||
get_console_log(actor.loglevel)
|
get_console_log(actor.loglevel)
|
||||||
import os
|
import os
|
||||||
log.info(
|
actor_info: str = (
|
||||||
'Started new trio process:\n'
|
|
||||||
f'|_{actor}\n'
|
f'|_{actor}\n'
|
||||||
f' uid: {actor.uid}\n'
|
f' uid: {actor.uid}\n'
|
||||||
f' pid: {os.getpid()}\n'
|
f' pid: {os.getpid()}\n'
|
||||||
f' parent_addr: {parent_addr}\n'
|
f' parent_addr: {parent_addr}\n'
|
||||||
f' loglevel: {actor.loglevel}\n'
|
f' loglevel: {actor.loglevel}\n'
|
||||||
)
|
)
|
||||||
|
log.info(
|
||||||
|
'Started new trio process:\n'
|
||||||
|
+
|
||||||
|
actor_info
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if infect_asyncio:
|
if infect_asyncio:
|
||||||
|
@ -133,8 +137,14 @@ def _trio_main(
|
||||||
trio.run(trio_main)
|
trio.run(trio_main)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
log.cancel(
|
log.cancel(
|
||||||
f'@{actor.uid} received KBI'
|
'Actor received KBI\n'
|
||||||
|
+
|
||||||
|
actor_info
|
||||||
)
|
)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
log.info(f"Actor {actor.uid} terminated")
|
log.info(
|
||||||
|
'Actor terminated\n'
|
||||||
|
+
|
||||||
|
actor_info
|
||||||
|
)
|
||||||
|
|
|
@ -342,7 +342,9 @@ async def open_root_actor(
|
||||||
# for an in nurseries:
|
# for an in nurseries:
|
||||||
# tempn.start_soon(an.exited.wait)
|
# tempn.start_soon(an.exited.wait)
|
||||||
|
|
||||||
logger.cancel("Shutting down root actor")
|
logger.info(
|
||||||
|
'Closing down root actor'
|
||||||
|
)
|
||||||
await actor.cancel(None) # self cancel
|
await actor.cancel(None) # self cancel
|
||||||
finally:
|
finally:
|
||||||
_state._current_actor = None
|
_state._current_actor = None
|
||||||
|
|
Loading…
Reference in New Issue