forked from goodboy/tractor
1
0
Fork 0

Only use `greenback` if actor-runtime is up..

multihomed
Tyler Goodlet 2024-01-02 11:28:02 -05:00
parent ce7b8a5e18
commit fdf3a1b01b
1 changed files with 25 additions and 18 deletions

View File

@ -682,7 +682,7 @@ async def pause(
https://en.wikipedia.org/wiki/Breakpoint
'''
__tracebackhide__ = True
# __tracebackhide__ = True
actor = tractor.current_actor()
pdb, undo_sigint = mk_mpdb()
task_name = trio.lowlevel.current_task().name
@ -836,11 +836,15 @@ async def pause(
# runtime aware version which takes care of all .
def pause_from_sync() -> None:
print("ENTER SYNC PAUSE")
actor: tractor.Actor = tractor.current_actor(
err_on_no_runtime=False,
)
if actor:
try:
import greenback
__tracebackhide__ = True
# __tracebackhide__ = True
actor: tractor.Actor = tractor.current_actor()
# task_can_release_tty_lock = trio.Event()
# spawn bg task which will lock out the TTY, we poll
@ -853,8 +857,11 @@ def pause_from_sync() -> None:
# release_lock_signal=task_can_release_tty_lock,
))
)
except ModuleNotFoundError:
log.warning('NO GREENBACK FOUND')
else:
log.warning('Not inside actor-runtime')
db, undo_sigint = mk_mpdb()
Lock.local_task_in_debug = 'sync'