%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/utils/ |
Current File : //lib/python2.7/site-packages/salt/utils/debug.pyo |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d e d � Z d S( u6 Print a stacktrace when sent a SIGUSR1 for debugging i ( t absolute_importt print_functiont unicode_literalsNc C@ s1 | j d � t j | d | �| j d � d S( u Pretty print the stack trace and environment information for debugging those hard to reproduce user problems. :) u* ======== Salt Debug Stack Trace ========= t fileu* ========================================= N( t writet tracebackt print_stack( t printoutt stack( ( s4 /usr/lib/python2.7/site-packages/salt/utils/debug.pyt _makepretty s c C@ s� t j j � r( t j } t | | � nd d j t t j � � � } t j j t j � | � } t j j j | d � � } t | | � Wd QXd S( uI Signal handler for SIGUSR1, only available on Unix-like systems u salt-debug-{0}.logu wN( t syst stderrt isattyR t formatt intt timet ost patht joint tempfilet gettempdirt saltt utilst filest fopen( t sigR t outputt filenamet destfile( ( s4 /usr/lib/python2.7/site-packages/salt/utils/debug.pyt _handle_sigusr1 s c C@ s� y d d l } Wn t k r$ d SX| j � r� | j � d j t t j � � t j � � } t j j t j � | � } | j � j | d d �t j j � r� t j j d j | � � n | j � n, t j j � r� t j j d � n | j � d S( uI Signal handler for SIGUSR2, only available on Unix-like systems i Nu callgrind.salt-{0}-{1}t typeu CALLGRINDu Saved profiling data to: {0} u Profiling started ( t yappit ImportErrort is_runningt stopR R R R t getpidR R R R t get_func_statst saveR R R R t clear_statst start( R R R R R ( ( s4 /usr/lib/python2.7/site-packages/salt/utils/debug.pyt _handle_sigusr2/ s $ c C@ s/ t t | � r+ t j t t | � | � n d S( uK Add signal handler for signal name if it exists on given platform N( t hasattrt signalt getattr( t signal_namet handler( ( s4 /usr/lib/python2.7/site-packages/salt/utils/debug.pyt enable_sig_handlerE s c C@ s t d t � t d t � d S( u� Pretty print a stack trace to the console or a debug log under /tmp when any of the salt daemons such as salt-master are sent a SIGUSR1 u SIGUSR1u SIGINFON( R. R ( ( ( s4 /usr/lib/python2.7/site-packages/salt/utils/debug.pyt enable_sigusr1_handlerM s c C@ s t d t � d S( u Toggle YAPPI profiler u SIGUSR2N( R. R( ( ( ( s4 /usr/lib/python2.7/site-packages/salt/utils/debug.pyt enable_sigusr2_handlerX s c C@ s i t j � d d d 6S( u@ Return a string of which function we are currently in. i i u co_name( t inspectR ( ( ( s4 /usr/lib/python2.7/site-packages/salt/utils/debug.pyt inspect_stack_ s i c C@ s- t j � } d | } t | � | d k r0 d S| | d } g } | t k ry y t j | � j } Wqy d } qy Xn t j | � } | r� | j | j � n d | j k r� | j | j d j j � n | j j } | d k r� | j | � n ~ d j | � } | r)| r)| d j | � 7} n | S( uU Get a name of a caller in the format module.class.method `skip` specifies how many levels of stack to skip while getting caller name. skip=1 means "who calls me", skip=2 "who calls my caller" etc. An empty string is returned if skipped levels exceed stack height Source: https://gist.github.com/techtonik/2151727 i i u u selfu <module>u .u :{}N( R1 R t lent Truet getframeinfot linenot Nonet getmodulet appendt __name__t f_localst __class__t f_codet co_nameR R ( t skipt include_linenoR R'