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


Python EventSubscriber.stop方法代码示例

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


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

示例1: test_pub_on_different_subtypes

# 需要导入模块: from pyon.event.event import EventSubscriber [as 别名]
# 或者: from pyon.event.event.EventSubscriber import stop [as 别名]
    def test_pub_on_different_subtypes(self):
        ar = event.AsyncResult()
        gq = queue.Queue()
        self.count = 0

        def cb(event, *args, **kwargs):
            self.count += 1
            gq.put(event)
            if event.description == "end":
                ar.set()

        sub = EventSubscriber(event_type="ResourceModifiedEvent", sub_type="st1", callback=cb)
        sub.start()

        pub1 = EventPublisher(event_type="ResourceModifiedEvent")
        pub2 = EventPublisher(event_type="ContainerLifecycleEvent")

        pub1.publish_event(origin="two", sub_type="st2", description="2")
        pub2.publish_event(origin="three", sub_type="st1", description="3")
        pub1.publish_event(origin="one", sub_type="st1", description="1")
        pub1.publish_event(origin="four", sub_type="st1", description="end")

        ar.get(timeout=5)
        sub.stop()

        res = []
        for x in xrange(self.count):
            res.append(gq.get(timeout=5))

        self.assertEquals(len(res), 2)
        self.assertEquals(res[0].description, "1")
开发者ID:daf,项目名称:pyon,代码行数:33,代码来源:test_event.py

示例2: test_ingestion_failover

# 需要导入模块: from pyon.event.event import EventSubscriber [as 别名]
# 或者: from pyon.event.event.EventSubscriber import stop [as 别名]
    def test_ingestion_failover(self):
        stream_id, route, stream_def_id, dataset_id = self.make_simple_dataset()
        self.start_ingestion(stream_id, dataset_id)
        
        event = Event()

        def cb(*args, **kwargs):
            event.set()

        sub = EventSubscriber(event_type="ExceptionEvent", callback=cb, origin="stream_exception")
        sub.start()

        self.publish_fake_data(stream_id, route)
        self.wait_until_we_have_enough_granules(dataset_id, 40)
        
        file_path = DatasetManagementService._get_coverage_path(dataset_id)
        master_file = os.path.join(file_path, '%s_master.hdf5' % dataset_id)

        with open(master_file, 'w') as f:
            f.write('this will crash HDF')

        self.publish_hifi(stream_id, route, 5)


        self.assertTrue(event.wait(10))

        sub.stop()
开发者ID:jamie-cyber1,项目名称:coi-services,代码行数:29,代码来源:test_dm_end_2_end.py

示例3: test_instrument_device_metadata_notification_l4_ci_sa_rq_145_323

# 需要导入模块: from pyon.event.event import EventSubscriber [as 别名]
# 或者: from pyon.event.event.EventSubscriber import stop [as 别名]
    def test_instrument_device_metadata_notification_l4_ci_sa_rq_145_323(self):
        """
        Instrument management shall update physical resource metadata when change occurs

        For example, when there is a change of state.

        note from maurice 2012-05-18: consider this to mean a change of stored RR data
        """

        inst_obj = any_old(RT.InstrumentDevice)
        instrument_device_id, _ = self.RR.create(inst_obj)
        self.received_event = AsyncResult()

        #Create subscribers for agent and driver events.

        def consume_event(*args, **kwargs):
            self.received_event.set(True)
            log.info("L4-CI-SA-RQ-323")
            log.info("L4-CI-SA-RQ-145")

        event_sub = EventSubscriber(event_type="ResourceModifiedEvent", callback=consume_event)
        event_sub.start()


        inst_obj = self.RR.read(instrument_device_id)
        inst_obj.description = "brand new description"
        self.RR.update(inst_obj)

        #wait for event
        result = self.received_event.get(timeout=10)
        event_sub.stop()

        self.assertTrue(result)
开发者ID:kerfoot,项目名称:coi-services,代码行数:35,代码来源:test_l4_ci_sa.py

示例4: NotificationSubscription

# 需要导入模块: from pyon.event.event import EventSubscriber [as 别名]
# 或者: from pyon.event.event.EventSubscriber import stop [as 别名]
class NotificationSubscription(object):
    """
    Ties a notification's info to it's event subscriber
    """

    def  __init__(self, notification_request=None, callback=None):
        self._res_obj = notification_request  # The Notification Request Resource Object
        self.subscriber = EventSubscriber(  origin=notification_request.origin,
            origin_type = notification_request.origin_type,
            event_type=notification_request.event_type,
            sub_type=notification_request.event_subtype,
            callback=callback)
        self.notification_subscription_id = None

    def set_notification_id(self, id_=None):
        """
        Set the notification id of the notification object
        @param notification id
        """
        self.notification_subscription_id = id_

    def activate(self):
        """
        Start subscribing
        """
        self.subscriber.start()

    def deactivate(self):
        """
        Stop subscribing
        """
        self.subscriber.stop()
开发者ID:oceanzus,项目名称:coi-services,代码行数:34,代码来源:user_notification_service.py

示例5: EventPersister

# 需要导入模块: from pyon.event.event import EventSubscriber [as 别名]
# 或者: from pyon.event.event.EventSubscriber import stop [as 别名]
class EventPersister(StandaloneProcess):

    def on_init(self):
        # Time in between event persists
        self.persist_interval = 1.0

        # Holds received events FIFO
        self.event_queue = Queue()

        # Temporarily holds list of events to persist while datastore operation not yet completed
        self.events_to_persist = None

        # bookkeeping for timeout greenlet
        self._persist_greenlet = None
        self._terminate_persist = Event() # when set, exits the timeout greenlet

        # The event subscriber
        self.event_sub = None

    def on_start(self):
        # Persister thread
        self._persist_greenlet = spawn(self._trigger_func, self.persist_interval)
        log.debug('Publisher Greenlet started in "%s"' % self.__class__.__name__)

        # Event subscription
        self.event_sub = EventSubscriber(pattern=EventSubscriber.ALL_EVENTS, callback=self._on_event)
        self.event_sub.start()

    def on_quit(self):
        # Stop event subscriber
        self.event_sub.stop()

        # tell the trigger greenlet we're done
        self._terminate_persist.set()

        # wait on the greenlet to finish cleanly
        self._persist_greenlet.join(timeout=10)

    def _on_event(self, event, *args, **kwargs):
        self.event_queue.put(event)

    def _trigger_func(self, persist_interval):
        log.debug('Starting event persister thread with persist_interval=%s', persist_interval)

        # Event.wait returns False on timeout (and True when set in on_quit), so we use this to both exit cleanly and do our timeout in a loop
        while not self._terminate_persist.wait(timeout=persist_interval):
            try:
                self.events_to_persist = [self.event_queue.get() for x in xrange(self.event_queue.qsize())]

                self._persist_events(self.events_to_persist)
                self.events_to_persist = None
            except Exception as ex:
                log.exception("Failed to persist received events")
                return False

    def _persist_events(self, event_list):
        if event_list:
            bootstrap.container_instance.event_repository.put_events(event_list)
开发者ID:kerfoot,项目名称:coi-services,代码行数:60,代码来源:event_persister.py

示例6: DatasetMonitor

# 需要导入模块: from pyon.event.event import EventSubscriber [as 别名]
# 或者: from pyon.event.event.EventSubscriber import stop [as 别名]
class DatasetMonitor(object):
    def __init__(self, dataset_id):
        self.dataset_id = dataset_id
        self.event = Event()

        self.es = EventSubscriber(event_type=OT.DatasetModiied, callback=self.cb, origin=self.dataset_id, auto_delete=True)
        self.es.start()
    
    def cb(self, *args, **kwargs):
        self.event.set()

    def stop(self):
        self.es.stop()
开发者ID:jamie-cyber1,项目名称:coi-services,代码行数:15,代码来源:test_dm_end_2_end.py

示例7: TransformEventListener

# 需要导入模块: from pyon.event.event import EventSubscriber [as 别名]
# 或者: from pyon.event.event.EventSubscriber import stop [as 别名]
class TransformEventListener(TransformEventProcess):

    def on_start(self):
        event_type = self.CFG.get_safe('process.event_type', '')

        self.listener = EventSubscriber(event_type=event_type, callback=self.process_event)
        self.listener.start()

    def process_event(self, msg, headers):
        raise NotImplementedError('Method process_event not implemented')

    def on_quit(self):
        self.listener.stop()
开发者ID:swarbhanu,项目名称:pyon,代码行数:15,代码来源:transforma.py

示例8: InstrumentAgentEventSubscribers

# 需要导入模块: from pyon.event.event import EventSubscriber [as 别名]
# 或者: from pyon.event.event.EventSubscriber import stop [as 别名]
class InstrumentAgentEventSubscribers(object):
    """
    Create subscribers for agent and driver events.
    """

    log.info("Start event subscribers")

    def __init__(self, instrument_agent_resource_id=None):
        # Start event subscribers, add stop to cleanup.
        self.no_events = None
        self.events_received = []
        self.async_event_result = AsyncResult()
        self.event_subscribers = []

        def consume_event(*args, **kwargs):
            log.debug(
                "#**#**# Event subscriber (consume_event) recieved ION event: args=%s, kwargs=%s, event=%s.",
                str(args),
                str(kwargs),
                str(args[0]),
            )

            log.debug("self.no_events = " + str(self.no_events))
            log.debug("self.event_received = " + str(self.events_received))

            self.events_received.append(args[0])
            if self.no_events and self.no_events == len(self.events_received):
                log.debug("CALLING self.async_event_result.set()")
                self.async_event_result.set()

        self.event_subscribers = EventSubscriber(
            event_type="ResourceAgentEvent", callback=consume_event, origin=instrument_agent_resource_id
        )
        self.event_subscribers.start()
        self.event_subscribers._ready_event.wait(timeout=5)

    def clear_events(self):
        """
        Reset event counter
        """
        self._events_received = []

    def stop(self):
        try:
            self.event_subscribers.stop()
        except Exception as ex:
            log.warn("Failed to stop event subscriber gracefully (%s)" % ex)

        self.event_subscribers = []
开发者ID:jdosher,项目名称:marine-integrations,代码行数:51,代码来源:instrument_agent_client.py

示例9: DatasetMonitor

# 需要导入模块: from pyon.event.event import EventSubscriber [as 别名]
# 或者: from pyon.event.event.EventSubscriber import stop [as 别名]
class DatasetMonitor(object):
    def __init__(self, dataset_id):
        self.dataset_id = dataset_id
        self.event = Event()

        self.es = EventSubscriber(event_type=OT.DatasetModified, callback=self.cb, origin=self.dataset_id, auto_delete=True)
        self.es.start()
    
    def cb(self, *args, **kwargs):
        self.event.set()

    def stop(self):
        self.es.stop()

    def wait(self, timeout=None):
        if timeout is None:
            timeout = CFG.get_safe('endpoint.receive.timeout', 10)
        return self.event.wait(timeout)
开发者ID:pkediyal,项目名称:coi-services,代码行数:20,代码来源:test_dm_end_2_end.py

示例10: TransformEventListener

# 需要导入模块: from pyon.event.event import EventSubscriber [as 别名]
# 或者: from pyon.event.event.EventSubscriber import stop [as 别名]
class TransformEventListener(TransformEventProcess):

    def __init__(self):
        super(TransformEventListener,self).__init__()

    def on_start(self):
        super(TransformEventListener,self).on_start()
        event_type = self.CFG.get_safe('process.event_type', '')
        queue_name = self.CFG.get_safe('process.queue_name', None)

        self.listener = EventSubscriber(event_type=event_type, queue_name=queue_name, callback=self.process_event)
        self.listener.start()

    def process_event(self, msg, headers):
        raise NotImplementedError('Method process_event not implemented')

    def on_quit(self):
        self.listener.stop()
        super(TransformEventListener,self).on_quit()
开发者ID:blazetopher,项目名称:coi-services,代码行数:21,代码来源:transform.py

示例11: DatasetMonitor

# 需要导入模块: from pyon.event.event import EventSubscriber [as 别名]
# 或者: from pyon.event.event.EventSubscriber import stop [as 别名]
class DatasetMonitor(object):
    def __init__(self, dataset_id=None, data_product_id=None):
        if data_product_id and not dataset_id:
            dataset_id = Container.instance.resource_registry.find_objects(data_product_id, PRED.hasDataset, id_only=True)[0][0]
        self.dataset_id = dataset_id
        self.event = Event()

        self.es = EventSubscriber(event_type=OT.DatasetModified, callback=self.cb, origin=self.dataset_id, auto_delete=True)
        self.es.start()
    
    def cb(self, *args, **kwargs):
        self.event.set()

    def stop(self):
        self.es.stop()

    def wait(self, timeout=None):
        if timeout is None:
            timeout = CFG.get_safe('endpoint.receive.timeout', 10)
        return self.event.wait(timeout)
开发者ID:MatthewArrott,项目名称:coi-services,代码行数:22,代码来源:test_dm_end_2_end.py

示例12: test_cei_launch_mode

# 需要导入模块: from pyon.event.event import EventSubscriber [as 别名]
# 或者: from pyon.event.event.EventSubscriber import stop [as 别名]
    def test_cei_launch_mode(self):
        
        pdc = ProcessDispatcherServiceClient(node=self.container.node)
        p_def = ProcessDefinition(name='Agent007')
        p_def.executable = {
            'module' : 'ion.agents.instrument.instrument_agent',
            'class' : 'InstrumentAgent'
        }
        p_def_id = pdc.create_process_definition(p_def)
        
        pid = pdc.create_process(p_def_id)
        
        def event_callback(event, *args, **kwargs):
            print '######### proc %s in state %s' % (event.origin, ProcessStateEnum._str_map[event.state])
 
        sub = EventSubscriber(event_type='ProcessLifecycleEvent',
                              callback=event_callback,
                              origin=pid,
                              origin_type='DispatchedProcess')
         
        sub.start()

        agent_config = deepcopy(self._agent_config)
        agent_config['bootmode'] = 'restart'
        pdc.schedule_process(p_def_id, process_id=pid,
                             configuration=agent_config)
        
        gevent.sleep(5)
        
        pdc.cancel_process(pid)
        
        gevent.sleep(15)

        sub.stop()
        
        
开发者ID:ednad,项目名称:coi-services,代码行数:36,代码来源:test_agent_persistence.py

示例13: NotificationWorker

# 需要导入模块: from pyon.event.event import EventSubscriber [as 别名]
# 或者: from pyon.event.event.EventSubscriber import stop [as 别名]
class NotificationWorker(SimpleProcess):
    """
    Instances of this class acts as a Notification Worker.
    """

    def on_init(self):
        self.event_pub = EventPublisher()
        self.user_info = {}
        self.resource_registry = ResourceRegistryServiceClient()

    def test_hook(self, user_info, reverse_user_info):
        """
        This method exists only to facilitate the testing of the reload of the user_info dictionary
        """
        pass

    def on_start(self):
        super(NotificationWorker, self).on_start()

        self.smtp_client = setting_up_smtp_client()

        # ------------------------------------------------------------------------------------
        # Start by loading the user info and reverse user info dictionaries
        # ------------------------------------------------------------------------------------

        try:
            self.user_info = self.load_user_info()
            self.reverse_user_info = calculate_reverse_user_info(self.user_info)

            log.info("On start up, notification workers loaded the following user_info dictionary: %s" % self.user_info)
            log.info("The calculated reverse user info: %s" % self.reverse_user_info)

        except NotFound as exc:
            if exc.message.find("users_index") > -1:
                log.warning("Notification workers found on start up that users_index have not been loaded yet.")
            else:
                raise NotFound(exc.message)

        # ------------------------------------------------------------------------------------
        # Create an event subscriber for Reload User Info events
        # ------------------------------------------------------------------------------------

        def reload_user_info(event_msg, headers):
            """
            Callback method for the subscriber to ReloadUserInfoEvent
            """

            notification_id = event_msg.notification_id
            log.info(
                "(Notification worker received a ReloadNotificationEvent. The relevant notification_id is %s"
                % notification_id
            )

            try:
                self.user_info = self.load_user_info()
            except NotFound:
                log.warning("ElasticSearch has not yet loaded the user_index.")

            self.reverse_user_info = calculate_reverse_user_info(self.user_info)
            self.test_hook(self.user_info, self.reverse_user_info)

            log.debug("After a reload, the user_info: %s" % self.user_info)
            log.debug("The recalculated reverse_user_info: %s" % self.reverse_user_info)

        # the subscriber for the ReloadUSerInfoEvent
        self.reload_user_info_subscriber = EventSubscriber(event_type="ReloadUserInfoEvent", callback=reload_user_info)
        self.reload_user_info_subscriber.start()

        # ------------------------------------------------------------------------------------
        # Create an event subscriber for all events that are of interest for notifications
        # ------------------------------------------------------------------------------------

        self.event_subscriber = EventSubscriber(queue_name="uns_queue", callback=self.process_event)
        self.event_subscriber.start()

    def process_event(self, msg, headers):
        """
        Callback method for the subscriber listening for all events
        """
        # ------------------------------------------------------------------------------------
        # From the reverse user info dict find out which users have subscribed to that event
        # ------------------------------------------------------------------------------------

        users = []
        if self.reverse_user_info:
            users = check_user_notification_interest(event=msg, reverse_user_info=self.reverse_user_info)

        log.info("Type of event received by notification worker: %s" % msg.type_)
        log.info("Notification worker deduced the following users were interested in the event: %s" % users)

        # ------------------------------------------------------------------------------------
        # Send email to the users
        # ------------------------------------------------------------------------------------

        for user_name in users:
            msg_recipient = self.user_info[user_name]["user_contact"].email
            send_email(message=msg, msg_recipient=msg_recipient, smtp_client=self.smtp_client)

    def on_stop(self):
        # close subscribers safely
#.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:coi-services,代码行数:103,代码来源:notification_worker.py

示例14: GovernanceController

# 需要导入模块: from pyon.event.event import EventSubscriber [as 别名]
# 或者: from pyon.event.event.EventSubscriber import stop [as 别名]
class GovernanceController(object):
    """
    This is a singleton object which handles governance functionality in the container.
    """

    def __init__(self,container):
        log.debug('GovernanceController.__init__()')
        self.container = container
        self.enabled = False
        self.interceptor_by_name_dict = dict()
        self.interceptor_order = []
        self.policy_decision_point_manager = None
        self.governance_dispatcher = None

        # Holds a list per service operation of policy methods to check before the op in a process is allowed to be called
        self._service_op_preconditions = dict()

        self._is_container_org_boundary = False
        self._container_org_name = None
        self._container_org_id = None

    def start(self):

        log.debug("GovernanceController starting ...")

        self._CFG = CFG

        self.enabled = CFG.get_safe('interceptor.interceptors.governance.config.enabled', False)

        log.info("GovernanceInterceptor enabled: %s" % str(self.enabled))

        self.policy_event_subscriber = None

        #containers default to not Org Boundary and ION Root Org
        self._is_container_org_boundary = CFG.get_safe('container.org_boundary',False)
        self._container_org_name = CFG.get_safe('container.org_name', CFG.get_safe('system.root_org', 'ION'))
        self._container_org_id = None
        self._system_root_org_name = CFG.get_safe('system.root_org', 'ION')

        self._is_root_org_container = (self._container_org_name == self._system_root_org_name)

        if self.enabled:

            config = CFG.get_safe('interceptor.interceptors.governance.config')

            self.initialize_from_config(config)

            self.policy_event_subscriber = EventSubscriber(event_type=OT.PolicyEvent, callback=self.policy_event_callback)
            self.policy_event_subscriber.start()

            self.rr_client = ResourceRegistryServiceProcessClient(node=self.container.node, process=self.container)
            self.policy_client = PolicyManagementServiceProcessClient(node=self.container.node, process=self.container)

    def initialize_from_config(self, config):

        self.governance_dispatcher = GovernanceDispatcher()

        self.policy_decision_point_manager = PolicyDecisionPointManager(self)

        if 'interceptor_order' in config:
            self.interceptor_order = config['interceptor_order']

        if 'governance_interceptors' in config:
            gov_ints = config['governance_interceptors']

            for name in gov_ints:
                interceptor_def = gov_ints[name]

                # Instantiate and put in by_name array
                parts = interceptor_def["class"].split('.')
                modpath = ".".join(parts[:-1])
                classname = parts[-1]
                module = __import__(modpath, fromlist=[classname])
                classobj = getattr(module, classname)
                classinst = classobj()

                # Put in by_name_dict for possible re-use
                self.interceptor_by_name_dict[name] = classinst

    def stop(self):
        log.debug("GovernanceController stopping ...")

        if self.policy_event_subscriber is not None:
            self.policy_event_subscriber.stop()


    @property
    def is_container_org_boundary(self):
        return self._is_container_org_boundary

    @property
    def container_org_name(self):
        return self._container_org_name

    @property
    def system_root_org_name(self):
        return self._system_root_org_name

    @property
    def is_root_org_container(self):
#.........这里部分代码省略.........
开发者ID:seman,项目名称:pyon,代码行数:103,代码来源:governance_controller.py

示例15: TestAlerts

# 需要导入模块: from pyon.event.event import EventSubscriber [as 别名]
# 或者: from pyon.event.event.EventSubscriber import stop [as 别名]
class TestAlerts(IonIntegrationTestCase):
    """
    """
    
    ############################################################################
    # Setup, teardown.
    ############################################################################
        
    def setUp(self):
        """
        Set up subscribers for alarm events.
        """
        
        # Start container.
        log.info('Staring capability container.')
        self._start_container()

        self._event_count = 0
        self._events_received = []
        self._async_event_result = AsyncResult()
        self._resource_id = 'abc123'
        self._origin_type = "InstrumentDevice"

        def consume_event(*args, **kwargs):
            log.debug('Test recieved ION event: args=%s, kwargs=%s, event=%s.',
                     str(args), str(kwargs), str(args[0]))
            self._events_received.append(args[0])
            if self._event_count > 0 and \
                self._event_count == len(self._events_received):
                self._async_event_result.set()
            
            
        self._event_subscriber = EventSubscriber(
            event_type='DeviceStatusAlertEvent', callback=consume_event,
            origin=self._resource_id)
        
        self._event_subscriber.start()
        self._event_subscriber._ready_event.wait(timeout=5)

        def stop_subscriber():
            self._event_subscriber.stop()
            self._event_subscriber = None
            
        self.addCleanup(stop_subscriber)

    ###############################################################################
    # Tests.
    ###############################################################################

    def test_greater_than_interval(self):
        """
        """
        alert_def = {
            'name' : 'current_warning_interval',
            'description' : 'Current is above normal range.',
            'aggregate_type' : AggregateStatusType.AGGREGATE_DATA,
            'alert_type' : StreamAlertType.WARNING,
            'resource_id' : self._resource_id,
            'origin_type' : self._origin_type,
            'stream_name' : 'fakestreamname',
            'value_id' : 'port_current',
            'lower_bound' : 10.5,
            'lower_rel_op' : '<',
            'upper_bound' : None,
            'upper_rel_op' : None,
            'alert_class' : 'IntervalAlert'
        }

        cls = alert_def.pop('alert_class')
        alert = eval('%s(**alert_def)' % cls)

        status = alert.get_status()
        """
        {'status': None, 'alert_type': 1, 'lower_bound': 10.5, 'upper_rel_op': '<',
        'alert_class': 'IntervalAlert', 'message': 'Current is above normal range.',
        'stream_name': 'fakestreamname', 'name': 'current_warning_interval',
        'upper_bound': None, 'value': None, 'value_id': 'port_current',
        'lower_rel_op': None}
        """
        # This sequence will produce 5 alerts:
        # All clear on 30,
        # Warning on 5.5
        # All clear on 15.1
        # Warning on 3.3
        # All clear on 15.0
        self._event_count = 5
        test_vals = [30, 30.4, 5.5, 5.6, 15.1, 15.2,
                     15.3, 3.3, 3.4, 15.0, 15.5]

        for x in test_vals:
            alert.eval_alert(stream_name='fakestreamname',
                             value=x, value_id='port_current')

        self._async_event_result.get(timeout=30)        
        """
        {'origin': 'abc123', 'status': 1, '_id': '04ccd20d67574b2ea3df869f2b6d4123', 'description': 'The alert is cleared.', 'time_stamps': [], 'type_': 'DeviceStatusAlertEvent', 'valid_values': [], 'values': [30], 'value_id': 'port_current', 'base_types': ['DeviceStatusEvent', 'DeviceEvent', 'Event'], 'stream_name': 'fakestreamname', 'ts_created': '1366659152082', 'sub_type': 3, 'origin_type': 'InstrumentDevice', 'name': 'current_warning_interval'}
        {'origin': 'abc123', 'status': 1, '_id': '050d2c66eb47435888ecab9d58399922', 'description': 'Current is above normal range.', 'time_stamps': [], 'type_': 'DeviceStatusAlertEvent', 'valid_values': [], 'values': [5.5], 'value_id': 'port_current', 'base_types': ['DeviceStatusEvent', 'DeviceEvent', 'Event'], 'stream_name': 'fakestreamname', 'ts_created': '1366659152089', 'sub_type': 1, 'origin_type': 'InstrumentDevice', 'name': 'current_warning_interval'}
        {'origin': 'abc123', 'status': 1, '_id': '3294c5f7e2be413c806604e93b69e973', 'description': 'The alert is cleared.', 'time_stamps': [], 'type_': 'DeviceStatusAlertEvent', 'valid_values': [], 'values': [15.1], 'value_id': 'port_current', 'base_types': ['DeviceStatusEvent', 'DeviceEvent', 'Event'], 'stream_name': 'fakestreamname', 'ts_created': '1366659152095', 'sub_type': 3, 'origin_type': 'InstrumentDevice', 'name': 'current_warning_interval'}
        {'origin': 'abc123', 'status': 1, '_id': '99a98e19a1454740a8464dab8de4dc0e', 'description': 'Current is above normal range.', 'time_stamps': [], 'type_': 'DeviceStatusAlertEvent', 'valid_values': [], 'values': [3.3], 'value_id': 'port_current', 'base_types': ['DeviceStatusEvent', 'DeviceEvent', 'Event'], 'stream_name': 'fakestreamname', 'ts_created': '1366659152101', 'sub_type': 1, 'origin_type': 'InstrumentDevice', 'name': 'current_warning_interval'}
        {'origin': 'abc123', 'status': 1, '_id': '93a214ee727e424e8b6a7e024a4d89be', 'description': 'The alert is cleared.', 'time_stamps': [], 'type_': 'DeviceStatusAlertEvent', 'valid_values': [], 'values': [15.0], 'value_id': 'port_current', 'base_types': ['DeviceStatusEvent', 'DeviceEvent', 'Event'], 'stream_name': 'fakestreamname', 'ts_created': '1366659152108', 'sub_type': 3, 'origin_type': 'InstrumentDevice', 'name': 'current_warning_interval'}
#.........这里部分代码省略.........
开发者ID:ednad,项目名称:coi-services,代码行数:103,代码来源:test_alerts.py


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