def get_stack_info(): 'Returns a string showing the current stack for each running thread.' io = StringIO() where(duplicates = True, stream = io) stack_info = io.getvalue() return '\n\n'.join([datetime.now().isoformat(), stack_info])
def get_stack_info(): 'Returns a string showing the current stack for each running thread.' io = StringIO() where(duplicates=True, stream=io) stack_info = io.getvalue() return '\n\n'.join([datetime.now().isoformat(), stack_info])
def get_thread_stacks(): 'Returns a string showing the current stack for each active thread.' from common.commandline import where from cStringIO import StringIO io = StringIO() where(duplicates = True, stream = io) return io.getvalue()
def run(self): time.sleep(self.wait) threads = list(threading.enumerate()) if threads: print 'Remaining non-daemon threads:' for thread in threads: if not thread.isDaemon(): print ' ', thread collect_garbage_and_report() if self.sysexit: try: import common.commandline as cc cc.where() except Exception: traceback.print_exc() print >>sys.stderr, 'forcing shutdown...' os._exit(1)