job_scheduler.py 文件源码

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

项目:intel-manager-for-lustre 作者: intel-hpdd 项目源码 文件源码
def update_nids(self, nid_list):
        # Although this is creating/deleting a NID it actually rewrites the whole NID configuration for the node
        # this is all in here for now, but as we move to dynamic lnet it will probably get it's own file.
        with self._lock:
            lnet_configurations = set()
            lnet_nid_data = defaultdict(lambda: {'nid_updates': {}, 'nid_deletes': {}})

            for nid_data in nid_list:
                network_interface = NetworkInterface.objects.get(id = nid_data['network_interface'])
                lnet_configuration = LNetConfiguration.objects.get(host = network_interface.host_id)
                lnet_configurations.add(lnet_configuration)

                if str(nid_data['lnd_network']) == '-1':
                    lnet_nid_data[lnet_configuration]['nid_deletes'][network_interface.id] = nid_data
                else:
                    lnet_nid_data[lnet_configuration]['nid_updates'][network_interface.id] = nid_data

            jobs = []
            for lnet_configuration in lnet_configurations:
                jobs.append(ConfigureLNetJob(lnet_configuration = lnet_configuration,
                                             config_changes = json.dumps(lnet_nid_data[lnet_configuration])))

            with transaction.commit_on_success():
                command = Command.objects.create(message = "Configuring NIDS for hosts")
                self.CommandPlan.add_jobs(jobs, command)

        self.progress.advance()

        return command.id
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号