recreate_index.py 文件源码

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

项目:micromasters 作者: mitodl 项目源码 文件源码
def handle(self, *args, **kwargs):  # pylint: disable=unused-argument
        """
        Recreates the index
        """
        log = logging.getLogger(indexing_api_name)
        console = logging.StreamHandler(self.stderr)
        console.setLevel(logging.DEBUG)
        log.addHandler(console)
        log.level = logging.INFO

        if kwargs['profile']:
            import cProfile
            import uuid
            profile = cProfile.Profile()
            profile.enable()
            recreate_index()
            profile.disable()
            filename = 'recreate_index_{}.profile'.format(uuid.uuid4())
            profile.dump_stats(filename)
            self.stdout.write('Output profiling data to: {}'.format(filename))
        else:
            recreate_index()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号