Add field-first subproca `.info()` to `._entry`

ctx_cancel_semantics_and_overruns
Tyler Goodlet 2024-02-29 20:01:39 -05:00
parent 7bb44e6930
commit 04aea5c4db
1 changed files with 15 additions and 13 deletions

View File

@ -106,25 +106,25 @@ def _trio_main(
Entry point for a `trio_run_in_process` subactor.
'''
log.info(f"Started new trio process for {actor.uid}")
if actor.loglevel is not None:
log.info(
f"Setting loglevel for {actor.uid} to {actor.loglevel}")
get_console_log(actor.loglevel)
log.info(
f"Started {actor.uid}")
_state._current_actor = actor
log.debug(f"parent_addr is {parent_addr}")
trio_main = partial(
async_main,
actor,
parent_addr=parent_addr
)
if actor.loglevel is not None:
get_console_log(actor.loglevel)
import os
log.info(
'Started new trio process:\n'
f'|_{actor}\n'
f' uid: {actor.uid}\n'
f' pid: {os.getpid()}\n'
f' parent_addr: {parent_addr}\n'
f' loglevel: {actor.loglevel}\n'
)
try:
if infect_asyncio:
actor._infected_aio = True
@ -132,7 +132,9 @@ def _trio_main(
else:
trio.run(trio_main)
except KeyboardInterrupt:
log.cancel(f"Actor {actor.uid} received KBI")
log.cancel(
f'@{actor.uid} received KBI'
)
finally:
log.info(f"Actor {actor.uid} terminated")