Esempio n. 1
0
    def refresh_pipeline(self):
        mtime = pipeline.get_pipeline_mtime()
        if mtime > self.pipeline_mtime:
            LOG.info(_LI('Pipeline configuration file has been updated.'))

            self.pipeline_mtime = mtime
            _hash = pipeline.get_pipeline_hash()

            if _hash != self.pipeline_hash:
                LOG.info(_LI("Detected change in pipeline configuration."))

                try:
                    # Pipeline in the notification agent.
                    if hasattr(self, 'pipeline_manager'):
                        self.pipeline_manager = pipeline.setup_pipeline()
                    # Polling in the polling agent.
                    elif hasattr(self, 'polling_manager'):
                        self.polling_manager = pipeline.setup_polling()
                    LOG.debug("Pipeline has been refreshed. "
                              "old hash: %(old)s, new hash: %(new)s",
                              {'old': self.pipeline_hash,
                               'new': _hash})
                except Exception as err:
                    LOG.debug("Active pipeline config's hash is %s",
                              self.pipeline_hash)
                    LOG.exception(_LE('Unable to load changed pipeline: %s')
                                  % err)
                    return

                self.pipeline_hash = _hash
                self.reload_pipeline()
Esempio n. 2
0
    def init_pipeline_refresh(self):
        if cfg.CONF.refresh_pipeline_cfg:

            self.pipeline_mtime = pipeline.get_pipeline_mtime()
            self.pipeline_hash = pipeline.get_pipeline_hash()

            self.tg.add_timer(cfg.CONF.pipeline_polling_interval,
                              self.refresh_pipeline)
Esempio n. 3
0
    def init_pipeline_refresh(self):
        """Initializes pipeline refresh state."""
        self.clear_pipeline_validation_status()
        if cfg.CONF.refresh_pipeline_cfg:
            self.set_pipeline_mtime(pipeline.get_pipeline_mtime())
            self.set_pipeline_hash(pipeline.get_pipeline_hash())

        if cfg.CONF.refresh_event_pipeline_cfg:
            self.set_pipeline_mtime(pipeline.get_pipeline_mtime(
                pipeline.EVENT_TYPE), pipeline.EVENT_TYPE)
            self.set_pipeline_hash(pipeline.get_pipeline_hash(
                pipeline.EVENT_TYPE), pipeline.EVENT_TYPE)

        if (cfg.CONF.refresh_pipeline_cfg or
                cfg.CONF.refresh_event_pipeline_cfg):
            self.tg.add_timer(cfg.CONF.pipeline_polling_interval,
                              self.refresh_pipeline)
Esempio n. 4
0
    def init_pipeline_refresh(self):
        """Initializes pipeline refresh state."""
        self.clear_pipeline_validation_status()
        if cfg.CONF.refresh_pipeline_cfg:
            self.set_pipeline_mtime(pipeline.get_pipeline_mtime())
            self.set_pipeline_hash(pipeline.get_pipeline_hash())

        if cfg.CONF.refresh_event_pipeline_cfg:
            self.set_pipeline_mtime(pipeline.get_pipeline_mtime(
                pipeline.EVENT_TYPE), pipeline.EVENT_TYPE)
            self.set_pipeline_hash(pipeline.get_pipeline_hash(
                pipeline.EVENT_TYPE), pipeline.EVENT_TYPE)

        self.refresh_pipeline_periodic = None
        if (cfg.CONF.refresh_pipeline_cfg or
                cfg.CONF.refresh_event_pipeline_cfg):
            self.refresh_pipeline_periodic = utils.create_periodic(
                target=self.refresh_pipeline,
                spacing=cfg.CONF.pipeline_polling_interval)
            utils.spawn_thread(self.refresh_pipeline_periodic.start)
Esempio n. 5
0
    def init_pipeline_refresh(self):
        """Initializes pipeline refresh state."""
        self.clear_pipeline_validation_status()
        if cfg.CONF.refresh_pipeline_cfg:
            self.set_pipeline_mtime(pipeline.get_pipeline_mtime())
            self.set_pipeline_hash(pipeline.get_pipeline_hash())

        if cfg.CONF.refresh_event_pipeline_cfg:
            self.set_pipeline_mtime(
                pipeline.get_pipeline_mtime(pipeline.EVENT_TYPE),
                pipeline.EVENT_TYPE)
            self.set_pipeline_hash(
                pipeline.get_pipeline_hash(pipeline.EVENT_TYPE),
                pipeline.EVENT_TYPE)

        self.refresh_pipeline_periodic = None
        if (cfg.CONF.refresh_pipeline_cfg
                or cfg.CONF.refresh_event_pipeline_cfg):
            self.refresh_pipeline_periodic = utils.create_periodic(
                target=self.refresh_pipeline,
                spacing=cfg.CONF.pipeline_polling_interval)
            utils.spawn_thread(self.refresh_pipeline_periodic.start)
Esempio n. 6
0
    def pipeline_changed(self, p_type=pipeline.SAMPLE_TYPE):
        """Returns hash of changed pipeline else False."""

        pipeline_mtime = self.get_pipeline_mtime(p_type)
        mtime = pipeline.get_pipeline_mtime(p_type)
        if mtime > pipeline_mtime:
            LOG.info(_LI('Pipeline configuration file has been updated.'))

            self.set_pipeline_mtime(mtime, p_type)
            _hash = pipeline.get_pipeline_hash(p_type)
            pipeline_hash = self.get_pipeline_hash(p_type)
            if _hash != pipeline_hash:
                LOG.info(_LI("Detected change in pipeline configuration."))
                return _hash
        return False
Esempio n. 7
0
    def pipeline_changed(self, p_type=pipeline.SAMPLE_TYPE):
        """Returns hash of changed pipeline else False."""

        pipeline_mtime = self.get_pipeline_mtime(p_type)
        mtime = pipeline.get_pipeline_mtime(p_type)
        if mtime > pipeline_mtime:
            LOG.info(_LI('Pipeline configuration file has been updated.'))

            self.set_pipeline_mtime(mtime, p_type)
            _hash = pipeline.get_pipeline_hash(p_type)
            pipeline_hash = self.get_pipeline_hash(p_type)
            if _hash != pipeline_hash:
                LOG.info(_LI("Detected change in pipeline configuration."))
                return _hash
        return False