Source code for switchyard.lib.debugging

# global: use in any timer callbacks
# to decide whether to handle the timer or not.
# if we're in the debugger, just drop it.

from functools import wraps
import pdb

in_debugger = False
def disable_timer():
    global in_debugger
    in_debugger = True

# decorate the "real" debugger entrypoint by
# disabling any SIGALRM invocations -- just ignore
# them if we're going into the debugger
def setup_debugger(f):
    def wrapper(*args, **kwargs):
        return f(*args, **kwargs)
    return wrapper

[docs]def debugger(): '''Invoke the interactive debugger. Can be used anywhere within a Switchyard program.''' pdb.Pdb(skip=['switchyard.lib.debugging']).set_trace()