job_scheduler.py 文件源码

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

项目:intel-manager-for-lustre 作者: intel-hpdd 项目源码 文件源码
def create_copytool(self, copytool_data):
        from django.db import transaction
        log.debug("Creating copytool from: %s" % copytool_data)
        with self._lock:
            host = ObjectCache.get_by_id(ManagedHost, int(copytool_data['host']))
            copytool_data['host'] = host
            filesystem = ObjectCache.get_by_id(ManagedFilesystem, int(copytool_data['filesystem']))
            copytool_data['filesystem'] = filesystem

            with transaction.commit_on_success():
                copytool = Copytool.objects.create(**copytool_data)

            # Add the copytool after the transaction commits
            ObjectCache.add(Copytool, copytool)

        log.debug("Created copytool: %s" % copytool)

        mount = self._create_client_mount(host, filesystem, copytool_data['mountpoint'])

        # Make the association between the copytool and client mount
        with self._lock:
            copytool.client_mount = mount

            with transaction.commit_on_success():
                copytool.save()

            ObjectCache.update(copytool)

        self.progress.advance()
        return copytool.id
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号