def handle_SIGUSR1(self, signum, frame):
# propagate the signal to children, but only if they are AVE processes
for pid in self.get_children():
name = get_proc_name(pid)
if name.startswith('ave-'):
os.kill(pid, signal.SIGUSR1)
# make the dump directory if it doesn't exist
hickup_dir = os.path.join(self.home, '.ave', 'hickup')
try:
os.makedirs(hickup_dir)
except OSError, e:
if e.errno != errno.EEXIST:
self.log('ERROR: could not create %s: %s' % (hickup_dir, e))
return
# create the trace file
date = time.strftime('%Y%m%d-%H%M%S')
name = '%s-%s-%d' % (date, self.proc_name, os.getpid())
path = os.path.join(hickup_dir, name)
with open(path, 'w') as f:
f.write('stack:\n%s' % ''.join(traceback.format_stack(frame)))
f.write('locals:\n%s\n' % frame.f_locals)
f.write('globals:\n%s' % frame.f_globals)
评论列表
文章目录