本文整理汇总了Python中gen.agent.ttypes.ProvisionRequest.cpu_overcommit方法的典型用法代码示例。如果您正苦于以下问题:Python ProvisionRequest.cpu_overcommit方法的具体用法?Python ProvisionRequest.cpu_overcommit怎么用?Python ProvisionRequest.cpu_overcommit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gen.agent.ttypes.ProvisionRequest
的用法示例。
在下文中一共展示了ProvisionRequest.cpu_overcommit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_config_change
# 需要导入模块: from gen.agent.ttypes import ProvisionRequest [as 别名]
# 或者: from gen.agent.ttypes.ProvisionRequest import cpu_overcommit [as 别名]
def test_config_change(self):
# Test chairman config change
chairman_callback1 = mock.MagicMock()
chairman_callback2 = mock.MagicMock()
chairman_server = [
ServerAddress("192.168.0.1", 8835),
ServerAddress("192.168.0.2", 8835),
]
self.agent.on_config_change(self.agent.CHAIRMAN, chairman_callback1)
self.agent.on_config_change(self.agent.CHAIRMAN, chairman_callback2)
provision = ProvisionRequest(chairman_server=chairman_server)
self.agent.update_config(provision)
chairman_callback1.assert_called_once_with(chairman_server)
chairman_callback2.assert_called_once_with(chairman_server)
self.assertFalse(self.agent.reboot_required)
# Test cpu_overcommit and memory_overcommit config change
cpu_callback = mock.MagicMock()
mem_callback = mock.MagicMock()
provision.cpu_overcommit = 5.0
provision.memory_overcommit = 6.0
self.agent.on_config_change(self.agent.CPU_OVERCOMMIT, cpu_callback)
self.agent.on_config_change(self.agent.MEMORY_OVERCOMMIT, mem_callback)
self.agent.update_config(provision)
cpu_callback.assert_called_once_with(5.0)
mem_callback.assert_called_once_with(6.0)
示例2: test_config_change
# 需要导入模块: from gen.agent.ttypes import ProvisionRequest [as 别名]
# 或者: from gen.agent.ttypes.ProvisionRequest import cpu_overcommit [as 别名]
def test_config_change(self):
# Test cpu_overcommit and memory_overcommit config change
cpu_callback = mock.MagicMock()
mem_callback = mock.MagicMock()
provision = ProvisionRequest()
provision.cpu_overcommit = 5.0
provision.memory_overcommit = 6.0
self.agent.on_config_change(self.agent.CPU_OVERCOMMIT, cpu_callback)
self.agent.on_config_change(self.agent.MEMORY_OVERCOMMIT, mem_callback)
self.agent.provision(provision)
cpu_callback.assert_called_once_with(5.0)
mem_callback.assert_called_once_with(6.0)