本文整理汇总了Python中cassandra.policies.RoundRobinPolicy.on_down方法的典型用法代码示例。如果您正苦于以下问题:Python RoundRobinPolicy.on_down方法的具体用法?Python RoundRobinPolicy.on_down怎么用?Python RoundRobinPolicy.on_down使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cassandra.policies.RoundRobinPolicy
的用法示例。
在下文中一共展示了RoundRobinPolicy.on_down方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_status_updates
# 需要导入模块: from cassandra.policies import RoundRobinPolicy [as 别名]
# 或者: from cassandra.policies.RoundRobinPolicy import on_down [as 别名]
def test_status_updates(self):
hosts = [0, 1, 2, 3]
policy = RoundRobinPolicy()
policy.populate(None, hosts)
policy.on_down(0)
policy.on_remove(1)
policy.on_up(4)
policy.on_add(5)
qplan = list(policy.make_query_plan())
self.assertEqual(sorted(qplan), [2, 3, 4, 5])
示例2: test_no_live_nodes
# 需要导入模块: from cassandra.policies import RoundRobinPolicy [as 别名]
# 或者: from cassandra.policies.RoundRobinPolicy import on_down [as 别名]
def test_no_live_nodes(self):
hosts = [0, 1, 2, 3]
policy = RoundRobinPolicy()
policy.populate(None, hosts)
for i in range(4):
policy.on_down(i)
query_plan = list(policy.make_query_plan())
self.assertEqual(query_plan, [])
示例3: test_no_live_nodes
# 需要导入模块: from cassandra.policies import RoundRobinPolicy [as 别名]
# 或者: from cassandra.policies.RoundRobinPolicy import on_down [as 别名]
def test_no_live_nodes(self):
"""
Ensure query plan for a downed cluster will execute without errors
"""
hosts = [0, 1, 2, 3]
policy = RoundRobinPolicy()
policy.populate(None, hosts)
for i in range(4):
policy.on_down(i)
qplan = list(policy.make_query_plan())
self.assertEqual(qplan, [])