本文整理汇总了Python中waldo.lib.Waldo.set_default_partner_timeout方法的典型用法代码示例。如果您正苦于以下问题:Python Waldo.set_default_partner_timeout方法的具体用法?Python Waldo.set_default_partner_timeout怎么用?Python Waldo.set_default_partner_timeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waldo.lib.Waldo
的用法示例。
在下文中一共展示了Waldo.set_default_partner_timeout方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import set_default_partner_timeout [as 别名]
def run_test():
'''
Tests Waldo's ability to detect a network failure between two endpoints
mid-sequence, thrown a NetworkException, and catch that exception using
a try-catch.
Returns true if the exception is caught and handled, and false otherwise.
'''
Waldo.set_default_heartbeat_period(1)
Waldo.set_default_partner_timeout(3)
acceptor_process.start()
time.sleep(SLEEP_TIME)
connector = Waldo.tcp_connect(Ping,HOST,PORT,signal_func)
return connector.testNetworkException()
示例2: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import set_default_partner_timeout [as 别名]
def run_test():
'''
Tests that Waldo can detect a network exception mid-sequence and propagate
that exception back through an endpoint call.
Returns true if the test passes and false otherwise.
'''
Waldo.set_default_heartbeat_period(1)
Waldo.set_default_partner_timeout(2)
acceptor_process.start()
time.sleep(SLEEP_TIME)
endpt = Waldo.tcp_connect(Ping, HOST, PORT)
endpt.addTerminationFunction(signal_func)
catcher = Waldo.no_partner_create(Catcher)
catcher.addEndpoint(endpt)
return catcher.testPropagateNetworkExceptionOnEndpointCall()
示例3: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import set_default_partner_timeout [as 别名]
def run_test():
'''
Tests Waldo's ability to detect a network failure between two endpoints
mid-sequence, thrown a NetworkException, and catch that exception using
a try-catch.
Returns true if the exception is caught and handled, and false otherwise.
'''
acceptor_process = Process(target=spawn_acceptor,args=())
Waldo.set_default_heartbeat_period(1)
Waldo.set_default_partner_timeout(3)
acceptor_process.start()
time.sleep(KILL_WAIT_TIME)
connector = Waldo.tcp_connect(Ping,HOST,PORT)
time.sleep(KILL_WAIT_TIME)
acceptor_process.terminate()
time.sleep(TIMEOUT_DETECT_TIME)
return connector.testNetworkException()
示例4: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import set_default_partner_timeout [as 别名]
def run_test():
'''
Tests Waldo's capability of propagating a network exception back through
a sequence. Here we have two pairs of endpoints: (a,b), (c,d). Endpoint a
begins a sequence with b, which makes and endpoint call to c, which
initiates a sequence with d. Endpoint d is in a separate process which is
manually terminated mid-sequence, thus a network exception should be
detected by c and propagated back to a.
Returns true if the exception is propagated back to the root of the
event and handled and false otherwise.
'''
global acceptor_proc
Waldo.set_default_heartbeat_period(1)
Waldo.set_default_partner_timeout(2)
acceptor_proc.start()
time.sleep(SLEEP_TIME) # make sure process is ready for tcp_connect
inner_ping = Waldo.tcp_connect(InnerPing, HOST, PORT_INNER)
Waldo.tcp_accept(OuterPong, HOST, PORT_OUTER, inner_ping)
outer_ping = Waldo.tcp_connect(OuterPing, HOST, PORT_OUTER)
result = outer_ping.testNestedSequencePropagation()
acceptor_proc.terminate()
return result