Exemplo n.º 1
0
 def _start_db_table_monitor(self, table_name):
     if table_name == 'publisher':
         table_monitor = pub_sub_api.StalePublisherMonitor(
             self.db,
             self.publisher,
             cfg.CONF.df.publisher_timeout,
             cfg.CONF.df.monitor_table_poll_time,
         )
     else:
         table_monitor = pub_sub_api.TableMonitor(
             table_name,
             self.db,
             self.publisher,
             cfg.CONF.df.monitor_table_poll_time,
         )
     table_monitor.daemonize()
     return table_monitor
Exemplo n.º 2
0
 def run(self):
     if self.multiproc_subscriber:
         self.multiproc_subscriber.daemonize()
     self.db.initialize(db_ip=cfg.CONF.df.remote_db_ip,
                        db_port=cfg.CONF.df.remote_db_port,
                        config=cfg.CONF.df)
     self._register_as_publisher()
     self._publishers_table_monitor = pub_sub_api.StalePublisherMonitor(
         self.db, self.publisher, cfg.CONF.df.publisher_timeout)
     self._publishers_table_monitor.daemonize()
     # TODO(oanson) TableMonitor daemonize will go here
     while True:
         try:
             event = self._queue.get()
             self.publisher.send_event(event)
             if event.table != pub_sub_api.PUBLISHER_TABLE:
                 self._update_timestamp_in_db()
             eventlet.sleep(0)
         except Exception as e:
             LOG.warning(
                 _LW("Exception in main loop: {}, {}").format(
                     e, traceback.format_exc()))