本文整理汇总了Python中mpx.service.subscription_manager.SUBSCRIPTION_MANAGER.poll_changed方法的典型用法代码示例。如果您正苦于以下问题:Python SUBSCRIPTION_MANAGER.poll_changed方法的具体用法?Python SUBSCRIPTION_MANAGER.poll_changed怎么用?Python SUBSCRIPTION_MANAGER.poll_changed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpx.service.subscription_manager.SUBSCRIPTION_MANAGER
的用法示例。
在下文中一共展示了SUBSCRIPTION_MANAGER.poll_changed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __values_changing
# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import poll_changed [as 别名]
def __values_changing(self, sid):
r1 = SUBSCRIPTION_MANAGER.poll_all(sid)
t1 = time.time()
while 1:
changed_values = SUBSCRIPTION_MANAGER.poll_changed(sid)
if len(changed_values):
return
if (time.time() - t1) > 1.0:
raise "Never got changes for any of the values."
time.sleep(0.1)
assert 1, "Can't reach here."
示例2: test_poll_changed
# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import poll_changed [as 别名]
def test_poll_changed(self):
sid = SUBSCRIPTION_MANAGER.create_polled(self.nrt1to4)
nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
if nrt != self.nrt1to4:
raise "Initial node reference table mismatch."
all_values = {}
time.sleep(0.1)
t1 = time.time()
while (time.time() - t1) < 1.0:
time.sleep(0.1)
changed_values = SUBSCRIPTION_MANAGER.poll_changed(sid)
all_values.update(changed_values)
if len(all_values) == 4:
# We got all 4 values!
return
raise "Never got changes for all four values, %d." % len(all_values)
return
示例3: subscription_poll_changed
# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import poll_changed [as 别名]
def subscription_poll_changed(self, sessionID, sid):
# Raise exception if this is not a valid session
if not self.manager().validate(sessionID, touch=1):
raise EInvalidSession('Invalid session')
return SUBSCRIPTION_MANAGER.poll_changed(sid)