本文整理匯總了Python中rediscluster.nodemanager.NodeManager.nodes方法的典型用法代碼示例。如果您正苦於以下問題:Python NodeManager.nodes方法的具體用法?Python NodeManager.nodes怎麽用?Python NodeManager.nodes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rediscluster.nodemanager.NodeManager
的用法示例。
在下文中一共展示了NodeManager.nodes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_reset
# 需要導入模塊: from rediscluster.nodemanager import NodeManager [as 別名]
# 或者: from rediscluster.nodemanager.NodeManager import nodes [as 別名]
def test_reset():
"""
Test that reset method resets variables back to correct default values.
"""
n = NodeManager(startup_nodes=[{}])
n.initialize = Mock()
n.slots = {"foo": "bar"}
n.nodes = ["foo", "bar"]
n.reset()
assert n.slots == {}
assert n.nodes == {}
示例2: test_determine_pubsub_node
# 需要導入模塊: from rediscluster.nodemanager import NodeManager [as 別名]
# 或者: from rediscluster.nodemanager.NodeManager import nodes [as 別名]
def test_determine_pubsub_node():
"""
Given a set of nodes it should determine the same pubsub node each time.
"""
n = NodeManager(startup_nodes=[{}])
n.nodes = {
"127.0.0.1:7001": {"host": "127.0.0.1", "port": 7001, "server_type": "master"},
"127.0.0.1:7005": {"host": "127.0.0.1", "port": 7005, "server_type": "master"},
"127.0.0.1:7000": {"host": "127.0.0.1", "port": 7000, "server_type": "master"},
"127.0.0.1:7002": {"host": "127.0.0.1", "port": 7002, "server_type": "master"},
}
n.determine_pubsub_node()
assert n.pubsub_node == {"host": "127.0.0.1", "port": 7005, "server_type": "master", "pubsub": True}