Example #1
0
    def start_periodic_tasks(self):
        self.periodic = periodics.PeriodicWorker.create(
            [], executor_factory=lambda: ThreadPoolExecutor(max_workers=10))

        self.add_events_table_expirer_timer()
        self.add_history_tables_expirer_timer()
        spawn(self.periodic.start)
Example #2
0
    def start_periodic_tasks(self):
        self.periodic = periodics.PeriodicWorker.create(
            [], executor_factory=lambda: ThreadPoolExecutor(max_workers=10))

        self.add_consistency_timer()
        self.add_rpc_datasources_timers()
        spawn(self.periodic.start)
Example #3
0
def main():
    """Main method of vitrage-graph"""

    print(VITRAGE_TITLE)
    config.parse_config(sys.argv)
    workers = GraphWorkersManager()
    spawn(init, workers)
    workers.run()
Example #4
0
 def _restart_from_stored_graph(self, graph_snapshot):
     LOG.info('Initializing graph from database snapshot (%sKb)',
              len(graph_snapshot.graph_snapshot) / 1024)
     NXGraph.read_gpickle(graph_snapshot.graph_snapshot, self.graph)
     self.persist.replay_events(self.graph, graph_snapshot.event_id)
     self._recreate_transformers_id_cache()
     LOG.info("%s vertices loaded", self.graph.num_vertices())
     self.subscribe_presist_notifier()
     spawn(self._start_all_workers, is_snapshot=True)
Example #5
0
def main():
    """Main method of vitrage-graph"""

    conf = service.prepare_service()
    LOG.info(VITRAGE_TITLE)

    workers = GraphWorkersManager(conf)
    spawn(init, conf, workers)
    workers.run()
Example #6
0
    def start_periodic_tasks(self, immediate_get_all):
        thread_num = len(utils.get_pull_drivers_names(self.conf))
        thread_num += 2  # for consistency and get_all
        self.periodic = periodics.PeriodicWorker.create(
            [],
            executor_factory=lambda: ThreadPoolExecutor(max_workers=thread_num
                                                        ))

        self._add_consistency_timer()
        self._add_datasource_timers(immediate_get_all)
        spawn(self.periodic.start)
 def run(self):
     LOG.info('Init Started')
     LOG.info('clearing database active_actions')
     self.db.active_actions.delete()
     ds_rpc.get_all(ds_rpc.create_rpc_client_instance(self.conf),
                    self.events_coordination,
                    self.conf.datasources.types,
                    action=DatasourceAction.INIT_SNAPSHOT,
                    retry_on_fault=True,
                    first_call_timeout=10)
     self.processor.start_notifier()
     spawn(self.start_all_workers)
     self.workers.run()
Example #8
0
 def run(self):
     LOG.info('Init Started')
     ds_rpc.get_all(ds_rpc.create_rpc_client_instance(self.conf),
                    self.events_coordination,
                    self.conf.datasources.types,
                    action=DatasourceAction.INIT_SNAPSHOT,
                    retry_on_fault=True,
                    first_call_timeout=10)
     self.processor.start_notifier()
     self.events_coordination.start()
     spawn(self.workers.submit_start_evaluations)
     self.scheduler.start_periodic_tasks()
     self.workers.run()
Example #9
0
 def _start_from_scratch(self):
     LOG.info('Starting for the first time')
     LOG.info('Clearing database active_actions')
     self.db.active_actions.delete()
     LOG.info('Disabling previously active alarms')
     self.db.history_facade.disable_alarms_in_history()
     self.subscribe_presist_notifier()
     ds_rpc.get_all(
         ds_rpc.create_rpc_client_instance(self.conf),
         self.events_coordination,
         self.conf.datasources.types,
         action=DatasourceAction.INIT_SNAPSHOT,
         retry_on_fault=True)
     LOG.info("%s vertices loaded", self.graph.num_vertices())
     self.persist.store_graph()
     spawn(self._start_all_workers, is_snapshot=False)
Example #10
0
    def run(self):
        LOG.info('Init Started')
        graph_snapshot = self.persist.query_recent_snapshot()
        if graph_snapshot:
            t = spawn(self.workers.submit_read_db_graph)
            self._restart_from_stored_graph(graph_snapshot)
            t.join()
            self.workers.submit_enable_evaluations()

        else:
            self._start_from_scratch()
            self.workers.submit_read_db_graph()
            self.workers.submit_start_evaluations()
        self._init_finale(immediate_get_all=True if graph_snapshot else False)
Example #11
0
 def start(self):
     spawn(self._start)
Example #12
0
 def __init__(self, worker_id, conf):
     super(CollectorService, self).__init__(worker_id)
     self.csvc = CollectorRpcHandlerService(conf)
     utils.spawn(self.csvc.start)
     self.lsvc = ListenerService(conf)
     utils.spawn(self.lsvc.start)