本文整理匯總了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)