当前位置: 首页>>代码示例>>Python>>正文


Python SUBSCRIPTION_MANAGER.create_delivered方法代码示例

本文整理汇总了Python中mpx.service.subscription_manager.SUBSCRIPTION_MANAGER.create_delivered方法的典型用法代码示例。如果您正苦于以下问题:Python SUBSCRIPTION_MANAGER.create_delivered方法的具体用法?Python SUBSCRIPTION_MANAGER.create_delivered怎么用?Python SUBSCRIPTION_MANAGER.create_delivered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mpx.service.subscription_manager.SUBSCRIPTION_MANAGER的用法示例。


在下文中一共展示了SUBSCRIPTION_MANAGER.create_delivered方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_targeted_event_handling

# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import create_delivered [as 别名]
    def test_targeted_event_handling(self):
        event_maker = EventProducerTestClass()
        event_maker.configure({'name':'EventProducerTester','parent':'/'})
        event_maker.start()
        nr = {1:event_maker}
        sid = SUBSCRIPTION_MANAGER.create_delivered(self, nr)

        # Wait for polling to start and verify value made it without any events
        t1 = time.time()
        while (time.time() - t1) < 1.0:
            all_values = SUBSCRIPTION_MANAGER.poll_all(sid)
            time.sleep(0.1)
        # Check that subscription value is the initial value of 100
        if all_values[1]['value'] != 100:
            raise ("polled_event_handling did not return inital value: " +
                   str(all_values[1]['value']))
        # make a rapid series of changes to the node value
        for i in range(10):
            event_maker._cov_check(i)
            time.sleep(0.1)
        # check change count, should be approx 10
        value_updates = self.__event_updated_values[1]['changes']
        cov_counts = self._cov_counter
        if value_updates < cov_counts:
            raise (
                "Targeted event handling event count did not match %d vs %d"
                % (value_updates, cov_counts)
                )
开发者ID:mcruse,项目名称:monotone,代码行数:30,代码来源:_test_case_subscription_manager.py

示例2: get

# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import create_delivered [as 别名]
 def get(self, skipcache=0):
     if self.link:
         if not self._smid:
             try:
                 value = self.as_node(self.link).get() #get it once to force autodiscovery
                 if hasattr(value, 'as_magnitude'):
                     value = value.as_magnitude()
                 self._last_value = value
                 self._smid = SM.create_delivered(self, {1:self.link}) #ID of subscription used for all descendent mpx_get templates
             except:
                 msglog.exception()
     return self._last_value
开发者ID:mcruse,项目名称:monotone,代码行数:14,代码来源:bacnet_scheduler.py

示例3: test_create_delivered

# 需要导入模块: from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER [as 别名]
# 或者: from mpx.service.subscription_manager.SUBSCRIPTION_MANAGER import create_delivered [as 别名]
 def test_create_delivered(self):
     sid = SUBSCRIPTION_MANAGER.create_delivered(self, self.nrt1to4)
     nrt = SUBSCRIPTION_MANAGER.node_reference_table(sid)
     if nrt != self.nrt1to4:
         raise "Initial node reference table mismatch."
     time.sleep(0.1)
     t1 = time.time()
     while (time.time() - t1) < 1.0:
         self.__event_lock.acquire()
         try:
             if len(self.__event_updated_values) == 4:
                 # We got all 4 values!
                 return
         finally:
             self.__event_lock.release()
         time.sleep(0.1)
     if len(self.__event_updated_values) != 4:
         raise (("Never got changes for all four values, only %d.\n"
                 "Values: %r") % (len(self.__event_updated_values),
                                  self.__event_updated_values))
开发者ID:mcruse,项目名称:monotone,代码行数:22,代码来源:_test_case_subscription_manager.py


注:本文中的mpx.service.subscription_manager.SUBSCRIPTION_MANAGER.create_delivered方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。