#NEWLINE# def worker_int( worker ) : #NEWLINE# #INDENT# worker . log . info ( 'worker received INT or QUIT signal' ) #NEWLINE# import threading , sys , traceback #NEWLINE# id2name = dict ( [ ( th . ident , th . name ) for th in threading . enumerate ( ) ] ) #NEWLINE# code = [ ] #NEWLINE# for ( threadId , stack ) in sys . _current_frames ( ) . items ( ) : #NEWLINE# #INDENT# code . append ( ( '\n# Thread: %s(%d)' % ( id2name . get ( threadId , '' ) , threadId ) ) ) #NEWLINE# for ( filename , lineno , name , line ) in traceback . extract_stack ( stack ) : #NEWLINE# #INDENT# code . append ( ( 'File: "%s", line %d, in %s' % ( filename , lineno , id2name ) ) ) #NEWLINE# if line : #NEWLINE# #INDENT# code . append ( ( '  %s' % line . strip ( ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# worker . log . debug ( '\n' . join ( code ) )