本文整理汇总了Python中framework.Framework.schedule方法的典型用法代码示例。如果您正苦于以下问题:Python Framework.schedule方法的具体用法?Python Framework.schedule怎么用?Python Framework.schedule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类framework.Framework
的用法示例。
在下文中一共展示了Framework.schedule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_simple_put
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import schedule [as 别名]
def test_simple_put(self):
for _ in range(6):
dynamo1.DynamoNode()
a = dynamo1.DynamoClientNode('a')
a.put('K1', None, 1)
Framework.schedule()
print History.ladder()
示例2: test_put2_fail_nodes23_5
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import schedule [as 别名]
def test_put2_fail_nodes23_5(self):
"""Show Put after a failure including handoff, and the resulting Pings"""
(a, pref_list) = self.put_fail_nodes23(dynamo4)
coordinator = pref_list[0]
from_line = len(History.history)
a.put('K1', None, 2, destnode=coordinator) # Send client request to coordinator for clarity
Framework.schedule(timers_to_process=10)
print History.ladder(force_include=pref_list, start_line=from_line, spacing=16)
示例3: test_put2_fail_nodes23_2
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import schedule [as 别名]
def test_put2_fail_nodes23_2(self):
"""Show second request for same key skipping failed nodes"""
(a, pref_list) = self.put_fail_nodes23(dynamo2)
coordinator = pref_list[0]
from_line = len(History.history)
a.put('K1', None, 2, destnode=coordinator) # Send client request to coordinator for clarity
Framework.schedule()
print History.ladder(force_include=pref_list, start_line=from_line, spacing=16)
示例4: test_partition_restore_metadata
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import schedule [as 别名]
def test_partition_restore_metadata(self):
self.partition()
self.partition_repair()
# Put a new value, which coalesces
a = Node.node['a']
getrsp = a.last_msg
putmsg = a.put('K1', getrsp.metadata, 101)
Framework.schedule(timers_to_process=0)
print putmsg.metadata
示例5: test_put2_fail_nodes23_3
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import schedule [as 别名]
def test_put2_fail_nodes23_3(self):
"""Show PingReq failing"""
(a, pref_list) = self.put_fail_nodes23(dynamo4)
coordinator = pref_list[0]
a.put('K1', None, 2, destnode=coordinator) # Send client request to coordinator for clarity
Framework.schedule(timers_to_process=0)
from_line = len(History.history)
Framework.schedule(timers_to_process=3)
print History.ladder(force_include=pref_list, start_line=from_line, spacing=16)
示例6: test_simple_get
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import schedule [as 别名]
def test_simple_get(self):
for _ in range(6):
dynamo1.DynamoNode()
a = dynamo1.DynamoClientNode('a')
a.put('K1', None, 1)
Framework.schedule()
from_line = len(History.history)
a.get('K1')
Framework.schedule()
print History.ladder(start_line=from_line)
示例7: test_double_put
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import schedule [as 别名]
def test_double_put(self):
for _ in range(6):
dynamo1.DynamoNode()
a = dynamo1.DynamoClientNode('a')
b = dynamo1.DynamoClientNode('b')
a.put('K1', None, 1)
Framework.schedule(1)
b.put('K2', None, 17)
Framework.schedule()
print History.ladder(spacing=14)
示例8: put_fail_initial_node
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import schedule [as 别名]
def put_fail_initial_node(self, cls):
for _ in range(6):
cls.DynamoNode()
a = cls.DynamoClientNode('a')
destnode = random.choice(cls.DynamoNode.nodelist)
a.put('K1', None, 1, destnode=destnode)
# Fail at the forwarding node before it gets a chance to forward
destnode.fail()
Framework.schedule()
print History.ladder()
示例9: partition_repair
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import schedule [as 别名]
def partition_repair(self):
# Repair the partition
History.add("announce", "Repair network partition")
Framework.cuts = []
Framework.schedule(timers_to_process=12)
# Get from node a
a = Node.node['a']
a.get('K1')
Framework.schedule(timers_to_process=0)
示例10: test_put2_fail_nodes23_6
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import schedule [as 别名]
def test_put2_fail_nodes23_6(self):
"""Show hinted handoff after recovery"""
(a, pref_list) = self.put_fail_nodes23(dynamo4)
coordinator = pref_list[0]
a.put('K1', None, 2, destnode=coordinator) # Send client request to coordinator for clarity
Framework.schedule(timers_to_process=10)
from_line = len(History.history)
pref_list[1].recover()
pref_list[2].recover()
Framework.schedule(timers_to_process=15)
print History.ladder(force_include=pref_list, start_line=from_line, spacing=16)
示例11: put_message
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import schedule [as 别名]
def put_message(self, fromnode, key, value, metadata):
#print 'client put!!!'
metadata = pickle.loads(metadata)
if metadata is None:
metadata = VectorClock()
else:
# A Put operation always implies convergence
metadata = VectorClock.converge(metadata)
putmsg = ClientPut(fromnode, self.addr, key, value, metadata)
Framework.send_message(putmsg)
# Framework.schedule(timers_to_process=0)
Framework.schedule()
示例12: put_fail_nodes23
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import schedule [as 别名]
def put_fail_nodes23(self, cls):
# Set up 6 nodes and 1 client node
for _ in range(6):
cls.DynamoNode()
a = cls.DynamoClientNode('a')
# Fail the second and third node in the preference list
pref_list = cls.DynamoNode.chash.find_nodes('K1', 5)[0]
a.put('K1', None, 1, destnode=pref_list[0])
Framework.schedule(1)
pref_list[1].fail()
pref_list[2].fail()
Framework.schedule(timers_to_process=2)
return a, pref_list
示例13: test_partition_restore
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import schedule [as 别名]
def test_partition_restore(self):
dynamomessages._show_metadata = True
all_nodes = self.partition()
self.partition_repair()
from_line = len(History.history)
# Put a new value, which coalesces
a = Node.node['a']
getrsp = a.last_msg
a.put('K1', getrsp.metadata, 101)
Framework.schedule(timers_to_process=0)
# Display, tweaking ordering of nodes so partition is in the middle
print History.ladder(force_include=all_nodes, start_line=from_line, spacing=16, key=lambda x: ' ' if x.name == 'b' else x.name)
dynamomessages._show_metadata = False
示例14: rcv_pingrsp
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import schedule [as 别名]
def rcv_pingrsp(self, pingmsg):
# Remove all instances of recovered node from failed node list
recovered_node = pingmsg.from_node
while recovered_node in self.failed_nodes:
self.failed_nodes.remove(recovered_node)
Framework.clearBlock(recovered_node)
if recovered_node in self.pending_handoffs:
for key in self.pending_handoffs[recovered_node]:
#print 'recovery ---------------------------------'
# Send our latest value for this key
(value, metadata) = self.retrieve(key)
putmsg = PutReq(self, recovered_node, key, value, metadata)
Framework.send_message(putmsg)
#print 'schedule'
Framework.schedule(timers_to_process=0)
del self.pending_handoffs[recovered_node]
示例15: recovery
# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import schedule [as 别名]
def recovery(self, node):
# Remove all instances of recovered node from failed node list
#print 'recover+++++++++++++++++++++++++++'
recovered_node = node
while recovered_node in self.failed_nodes:
self.failed_nodes.remove(recovered_node)
Framework.clearBlock(recovered_node)
if recovered_node in self.pending_handoffs:
for key in self.pending_handoffs[recovered_node]:
#print 'recovery ---------------------------------'
# Send our latest value for this key
(value, metadata) = self.retrieve(key)
putmsg = PutReq(self.addr, recovered_node, key, value, metadata)
Framework.send_message(putmsg)
Framework.schedule()
del self.pending_handoffs[recovered_node]