本文整理汇总了Python中mpx.service.subscription_manager.SUBSCRIPTION_MANAGER._set_tunable_parameters方法的典型用法代码示例。如果您正苦于以下问题:Python SUBSCRIPTION_MANAGER._set_tunable_parameters方法的具体用法?Python SUBSCRIPTION_MANAGER._set_tunable_parameters怎么用?Python SUBSCRIPTION_MANAGER._set_tunable_parameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpx.service.subscription_manager.SUBSCRIPTION_MANAGER
的用法示例。
在下文中一共展示了SUBSCRIPTION_MANAGER._set_tunable_parameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_poll_all_plus_exceptions
# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import _set_tunable_parameters [as 别名]
def test_poll_all_plus_exceptions(self):
SUBSCRIPTION_MANAGER._set_tunable_parameters({
'minimum_poll_interval':0.0,
})
nrt1to4bad5to6 = {}
nrt1to4bad5to6.update(self.nrt1to4)
nrt1to4bad5to6['/services/time/is/an/illusion'] = (
'/services/time/is/an/illusion'
)
nrt1to4bad5to6['/services/exception'] = '/services/exception'
sid = SUBSCRIPTION_MANAGER.create_polled(nrt1to4bad5to6)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
if nrt != nrt1to4bad5to6:
raise "Initial node reference table mismatch."
# Check that each invokation gets all values.
for i in range(0,10):
all_values = SUBSCRIPTION_MANAGER.poll_all(sid)
if len(all_values) != len(nrt1to4bad5to6):
# We did not get all 4 values!
raise (
"poll_all(self.nrt1to4) did not return all values."
" (%d out of %d)" % (len(all_values),len(nrt1to4bad5to6))
)
# Check that (eventually) all the values are result dictionaries.
all_values = SUBSCRIPTION_MANAGER.poll_all(sid)
t1 = time.time()
while (time.time() - t1) < 1.0:
if None not in all_values.values():
self.__all_plus_exceptions_check(all_values)
# Finally, test that a new subscription gets the correct
# results.
time.sleep(0.1)
sid = SUBSCRIPTION_MANAGER.create_polled(nrt1to4bad5to6)
time.sleep(0.1)
all_values = SUBSCRIPTION_MANAGER.poll_all(sid)
self.__all_plus_exceptions_check(all_values)
time.sleep(0.1)
all_values = SUBSCRIPTION_MANAGER.poll_all(sid)
self.__all_plus_exceptions_check(all_values)
return
time.sleep(0.1)
all_values = SUBSCRIPTION_MANAGER.poll_all(sid)
if None in all_values.values():
raise ("Never got values for all nodes: %r." % all_values)
return