control.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:ave 作者: sonyxperiadev 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号