models.py 文件源码

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

项目:planb 作者: ossobv 项目源码 文件源码
def run_rsync(self):
        cmd = self.generate_rsync_command()
        logger.info('Running %s: %s', self.friendly_name, ' '.join(cmd))

        # Close all DB connections before continuing with the rsync
        # command. Since it may take a while, the connection could get
        # dropped and we'd have issues later on.
        connections.close_all()

        try:
            output = check_output(cmd).decode('utf-8')
            returncode = 0
        except CalledProcessError as e:
            returncode, output = e.returncode, e.output
            errstr = RSYNC_EXITCODES.get(returncode, 'Return code not matched')
            logging.warning(
                'code: %s\nmsg: %s\nexception: %s', returncode, errstr, str(e))
            if returncode not in RSYNC_HARMLESS_EXITCODES:
                raise

        logger.info(
            'Rsync exited with code %s for %s. Output: %s',
            returncode, self.friendly_name, output)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号