Beispiel #1
0
    def add_rpc_datasources_timers(self):
        spacing = self.conf.datasources.snapshots_interval
        rpc_client = ds_rpc.create_rpc_client_instance(self.conf)

        @periodics.periodic(spacing=spacing)
        def get_all_periodic():
            try:
                ds_rpc.get_all(rpc_client,
                               self.events_coordination,
                               self.conf.datasources.types,
                               DatasourceAction.SNAPSHOT)
            except Exception as e:
                LOG.exception('get_all_periodic failed %s', e)

        self.periodic.add(get_all_periodic)
        LOG.info("added get_all_periodic (spacing=%s)", spacing)

        driver_names = utils.get_pull_drivers_names(self.conf)
        for d_name in driver_names:
            spacing = self.conf[d_name].changes_interval
            rpc_client = ds_rpc.create_rpc_client_instance(self.conf)

            @periodics.periodic(spacing=spacing)
            def get_changes_periodic(driver_name=d_name):
                try:
                    ds_rpc.get_changes(rpc_client,
                                       self.events_coordination,
                                       driver_name)
                except Exception as e:
                    LOG.exception('get_changes_periodic %s failed %s',
                                  driver_name, e)

            self.periodic.add(get_changes_periodic)
            LOG.info("added get_changes_periodic %s (spacing=%s)",
                     d_name, spacing)
 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()
Beispiel #3
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()
Beispiel #4
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)