collector.py 文件源码

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

项目:ecel 作者: ARL-UTEP-OC 项目源码 文件源码
def terminate(self):
        if not self.is_running():
            print ("  ...%s processes already dead" % self.name)
            return

        tps = []
        for process in self.processes:
            if process:
                parent_pid = process.pid
                parent = psutil.Process(parent_pid)
                try:
                    for child in parent.children(recursive=True):
                        child.kill()
                    parent.kill()
                except Exception as e:
                    print (" !! %s: %s" % (self.name, e))
                else:
                    tps.append(process.pid)
        print (" [x] Terminated: %s - pId(s): %s" % (self.name, ', '.join(str(p) for p in tps)))

        self.commands = []
        self.output_filenames = []
        self.processes = []
        self.pid_commands.clear()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号