Example #1
0
    def reload_pipeline(self):
        LOG.info(_LI("Reloading notification agent and listeners."))

        if self.pipeline_validated:
            self.pipe_manager = self._get_pipe_manager(
                self.transport, self.pipeline_manager)

        if self.event_pipeline_validated:
            self.event_pipe_manager = self._get_event_pipeline_manager(
                self.transport)

        with self.coord_lock:
            if self.shutdown:
                # NOTE(sileht): We are going to shutdown we everything will be
                # stopped, we should not restart them
                return

            # restart the main queue listeners.
            utils.kill_listeners(self.listeners)
            self._configure_main_queue_listeners(
                self.pipe_manager, self.event_pipe_manager)

            # restart the pipeline listeners if workload partitioning
            # is enabled.
            if cfg.CONF.notification.workload_partitioning:
                self._configure_pipeline_listener()
Example #2
0
    def reload_pipeline(self):
        LOG.info(_LI("Reloading notification agent and listeners."))

        if self.pipeline_validated:
            self.pipe_manager = self._get_pipe_manager(self.transport,
                                                       self.pipeline_manager)

        if self.event_pipeline_validated:
            self.event_pipe_manager = self._get_event_pipeline_manager(
                self.transport)

        with self.coord_lock:
            if self.shutdown:
                # NOTE(sileht): We are going to shutdown we everything will be
                # stopped, we should not restart them
                return

            # restart the main queue listeners.
            utils.kill_listeners(self.listeners)
            self._configure_main_queue_listeners(self.pipe_manager,
                                                 self.event_pipe_manager)

            # restart the pipeline listeners if workload partitioning
            # is enabled.
            if self.conf.notification.workload_partitioning:
                self._configure_pipeline_listener()
Example #3
0
 def stop(self):
     self.udp_run = False
     if self.sample_listener:
         utils.kill_listeners([self.sample_listener])
     if self.event_listener:
         utils.kill_listeners([self.event_listener])
     super(CollectorService, self).stop()
Example #4
0
 def stop(self):
     self.udp_run = False
     if self.sample_listener:
         utils.kill_listeners([self.sample_listener])
     if self.event_listener:
         utils.kill_listeners([self.event_listener])
     super(CollectorService, self).stop()
Example #5
0
 def terminate(self):
     if self.sample_listener:
         utils.kill_listeners([self.sample_listener])
     if self.event_listener:
         utils.kill_listeners([self.event_listener])
     if self.udp_thread:
         self.udp_run = False
         self.udp_thread.join()
     super(CollectorService, self).terminate()
Example #6
0
 def stop(self):
     self.udp_run = False
     if cfg.CONF.collector.enable_rpc and self.rpc_server:
         self.rpc_server.stop()
     if self.sample_listener:
         utils.kill_listeners([self.sample_listener])
     if self.event_listener:
         utils.kill_listeners([self.event_listener])
     super(CollectorService, self).stop()
Example #7
0
 def stop(self):
     self.udp_run = False
     if cfg.CONF.collector.enable_rpc and self.rpc_server:
         self.rpc_server.stop()
     if self.sample_listener:
         utils.kill_listeners([self.sample_listener])
     if self.event_listener:
         utils.kill_listeners([self.event_listener])
     super(CollectorService, self).stop()
Example #8
0
 def terminate(self):
     if self.sample_listener:
         utils.kill_listeners([self.sample_listener])
     if self.event_listener:
         utils.kill_listeners([self.event_listener])
     if self.udp_thread:
         self.udp_run = False
         self.udp_thread.join()
     super(CollectorService, self).terminate()
Example #9
0
 def stop(self):
     if getattr(self, 'partition_coordinator', None):
         self.partition_coordinator.stop()
     listeners = []
     if getattr(self, 'listeners', None):
         listeners.extend(self.listeners)
     if getattr(self, 'pipeline_listeners', None):
         listeners.extend(self.pipeline_listeners)
     utils.kill_listeners(listeners)
     super(NotificationService, self).stop()
Example #10
0
 def stop(self):
     if getattr(self, 'partition_coordinator', None):
         self.partition_coordinator.stop()
     listeners = []
     if getattr(self, 'listeners', None):
         listeners.extend(self.listeners)
     if getattr(self, 'pipeline_listeners', None):
         listeners.extend(self.pipeline_listeners)
     utils.kill_listeners(listeners)
     super(NotificationService, self).stop()
Example #11
0
 def stop(self):
     if self.started:
         if self.sample_listener:
             utils.kill_listeners([self.sample_listener])
         if self.event_listener:
             utils.kill_listeners([self.event_listener])
         if self.udp_thread:
             self.udp_run = False
             self.udp_thread.join()
     super(CollectorService, self).stop()
Example #12
0
 def stop(self):
     if self.started:
         if self.periodic:
             self.periodic.stop()
             self.periodic.wait()
         if self.partition_coordinator:
             self.partition_coordinator.stop()
         if self.pipeline_listener:
             utils.kill_listeners([self.pipeline_listener])
         utils.kill_listeners(self.listeners)
     super(NotificationService, self).stop()
Example #13
0
 def stop(self):
     if self.started:
         if self.periodic:
             self.periodic.stop()
             self.periodic.wait()
         if self.partition_coordinator:
             self.partition_coordinator.stop()
         if self.pipeline_listener:
             utils.kill_listeners([self.pipeline_listener])
         utils.kill_listeners(self.listeners)
     super(NotificationService, self).stop()
Example #14
0
 def terminate(self):
     self.shutdown = True
     if self.periodic:
         self.periodic.stop()
         self.periodic.wait()
     if self.partition_coordinator:
         self.partition_coordinator.stop()
     with self.coord_lock:
         if self.pipeline_listener:
             utils.kill_listeners([self.pipeline_listener])
         utils.kill_listeners(self.listeners)
     super(NotificationService, self).terminate()
Example #15
0
 def terminate(self):
     self.shutdown = True
     if self.periodic:
         self.periodic.stop()
         self.periodic.wait()
     if self.partition_coordinator:
         self.partition_coordinator.stop()
     with self.coord_lock:
         if self.pipeline_listener:
             utils.kill_listeners([self.pipeline_listener])
         utils.kill_listeners(self.listeners)
     super(NotificationService, self).terminate()
Example #16
0
    def reload_pipeline(self):
        LOG.info(_LI("Reloading notification agent and listeners."))

        self.pipe_manager = self._get_pipe_manager(
            self.transport, self.pipeline_manager)

        # re-start the main queue listeners.
        utils.kill_listeners(self.listeners)
        self._configure_main_queue_listeners(
            self.pipe_manager, self.event_pipe_manager)

        # re-start the pipeline listeners if workload partitioning
        # is enabled.
        if cfg.CONF.notification.workload_partitioning:
            self._refresh_agent(None)
Example #17
0
    def reload_pipeline(self):
        LOG.info(_LI("Reloading notification agent and listeners."))

        self.pipe_manager = self._get_pipe_manager(self.transport,
                                                   self.pipeline_manager)

        # re-start the main queue listeners.
        utils.kill_listeners(self.listeners)
        self._configure_main_queue_listeners(self.pipe_manager,
                                             self.event_pipe_manager)

        # re-start the pipeline listeners if workload partitioning
        # is enabled.
        if cfg.CONF.notification.workload_partitioning:
            self._refresh_agent(None)
Example #18
0
    def _configure_pipeline_listeners(self, reuse_listeners=False):
        with self.coord_lock:
            ev_pipes = []
            if cfg.CONF.notification.store_events:
                ev_pipes = self.event_pipeline_manager.pipelines
            pipelines = self.pipeline_manager.pipelines + ev_pipes
            transport = messaging.get_transport()
            partitioned = self.partition_coordinator.extract_my_subset(
                self.group_id,
                range(cfg.CONF.notification.pipeline_processing_queues))

            queue_set = {}
            for pipe_set, pipe in itertools.product(partitioned, pipelines):
                queue_set['%s-%s-%s' %
                          (self.NOTIFICATION_IPC, pipe.name, pipe_set)] = pipe

            if reuse_listeners:
                topics = queue_set.keys()
                kill_list = []
                for listener in self.pipeline_listeners:
                    if listener.dispatcher.targets[0].topic in topics:
                        queue_set.pop(listener.dispatcher.targets[0].topic)
                    else:
                        kill_list.append(listener)
                for listener in kill_list:
                    utils.kill_listeners([listener])
                    self.pipeline_listeners.remove(listener)
            else:
                utils.kill_listeners(self.pipeline_listeners)
                self.pipeline_listeners = []

            for topic, pipe in queue_set.items():
                LOG.debug('Pipeline endpoint: %s from set: %s', pipe.name,
                          pipe_set)
                pipe_endpoint = (pipeline.EventPipelineEndpoint
                                 if isinstance(pipe, pipeline.EventPipeline)
                                 else pipeline.SamplePipelineEndpoint)
                listener = messaging.get_batch_notification_listener(
                    transport,
                    [oslo_messaging.Target(topic=topic)],
                    [pipe_endpoint(self.ctxt, pipe)],
                    batch_size=cfg.CONF.notification.batch_size,
                    batch_timeout=cfg.CONF.notification.batch_timeout)
                listener.start()
                self.pipeline_listeners.append(listener)
Example #19
0
    def _configure_pipeline_listeners(self, reuse_listeners=False):
        with self.coord_lock:
            ev_pipes = []
            if cfg.CONF.notification.store_events:
                ev_pipes = self.event_pipeline_manager.pipelines
            pipelines = self.pipeline_manager.pipelines + ev_pipes
            transport = messaging.get_transport()
            partitioned = self.partition_coordinator.extract_my_subset(
                self.group_id,
                range(cfg.CONF.notification.pipeline_processing_queues))

            queue_set = {}
            for pipe_set, pipe in itertools.product(partitioned, pipelines):
                queue_set['%s-%s-%s' %
                          (self.NOTIFICATION_IPC, pipe.name, pipe_set)] = pipe

            if reuse_listeners:
                topics = queue_set.keys()
                kill_list = []
                for listener in self.pipeline_listeners:
                    if listener.dispatcher.targets[0].topic in topics:
                        queue_set.pop(listener.dispatcher.targets[0].topic)
                    else:
                        kill_list.append(listener)
                for listener in kill_list:
                    utils.kill_listeners([listener])
                    self.pipeline_listeners.remove(listener)
            else:
                utils.kill_listeners(self.pipeline_listeners)
                self.pipeline_listeners = []

            for topic, pipe in queue_set.items():
                LOG.debug('Pipeline endpoint: %s from set: %s', pipe.name,
                          pipe_set)
                pipe_endpoint = (pipeline.EventPipelineEndpoint if isinstance(
                    pipe, pipeline.EventPipeline) else
                                 pipeline.SamplePipelineEndpoint)
                listener = messaging.get_batch_notification_listener(
                    transport, [oslo_messaging.Target(topic=topic)],
                    [pipe_endpoint(self.ctxt, pipe)],
                    batch_size=cfg.CONF.notification.batch_size,
                    batch_timeout=cfg.CONF.notification.batch_timeout)
                listener.start()
                self.pipeline_listeners.append(listener)
Example #20
0
    def terminate(self):
        try:
            signal.signal(signal.SIGHUP, signal.SIG_IGN)
            signal.signal(signal.SIGTERM, signal.SIG_IGN)
        except Exception:
            LOG.debug("Signal only works in main thread.")

        # Parent process does not have sample_listener and
        # event-listener. Ensure the stop sequence is run to completion
        # otherwise the child processes won't get terminated and release
        # there database connections.
        if getattr(self, 'sample_listener', None):
            utils.kill_listeners([self.sample_listener])
        if getattr(self, 'event_listener', None):
            utils.kill_listeners([self.event_listener])
        if self.udp_thread:
            self.udp_run = False
            self.udp_thread.join()
        super(CollectorService, self).terminate()
    def terminate(self):
        try:
            signal.signal(signal.SIGHUP, signal.SIG_IGN)
            signal.signal(signal.SIGTERM, signal.SIG_IGN)
        except Exception:
            LOG.debug("Signal only works in main thread.")

        self.shutdown = True
        if self.periodic:
            self.periodic.stop()
            self.periodic.wait()
        if self.partition_coordinator:
            self.partition_coordinator.stop()
        with self.coord_lock:
            if self.pipeline_listener:
                utils.kill_listeners([self.pipeline_listener])
            utils.kill_listeners(self.listeners)

        super(NotificationService, self).terminate()
 def _refresh_agent(self, event):
     utils.kill_listeners(self.pipeline_listeners)
     self._configure_pipeline_listeners()
 def stop(self):
     if self.partition_coordinator:
         self.partition_coordinator.stop()
     utils.kill_listeners(self.listeners + self.pipeline_listeners)
     super(NotificationService, self).stop()
Example #24
0
 def stop(self):
     self.partition_coordinator.leave_group(self.group_id)
     utils.kill_listeners(self.listeners + self.pipeline_listeners)
     super(NotificationService, self).stop()
Example #25
0
 def _refresh_listeners(self):
     utils.kill_listeners(self.pipeline_listeners)
     self._configure_pipeline_listeners()
Example #26
0
 def stop(self):
     if self.partition_coordinator:
         self.partition_coordinator.stop()
     utils.kill_listeners(self.listeners + self.pipeline_listeners)
     super(NotificationService, self).stop()
Example #27
0
 def _refresh_agent(self, event):
     utils.kill_listeners(self.pipeline_listeners)
     self._configure_pipeline_listeners()
Example #28
0
 def _refresh_listeners(self):
     utils.kill_listeners(self.pipeline_listeners)
     self._configure_pipeline_listeners()