コード例 #1
0
 def __init__(self, conf, e_graph):
     super(VitrageApiHandlerService, self).__init__()
     self.conf = conf
     self.entity_graph = e_graph
     self.notifier = VitrageNotifier(self.conf, "vitrage.api",
                                     [EVALUATOR_TOPIC])
     self.db = storage.get_connection_from_config(conf)
コード例 #2
0
 def __init__(self,
              conf,
              entity_graph,
              actions_callback=None):
     self.conf = conf
     self.actions_callback = actions_callback or VitrageNotifier(
         conf, 'vitrage_consistency', [EVALUATOR_TOPIC]).notify
     self.graph = entity_graph
     self._init_datasources_to_mark_deleted()
コード例 #3
0
 def _init_instance(self):
     actions_callback = VitrageNotifier(conf=self._conf,
                                        publisher_id='vitrage_evaluator',
                                        topics=[EVALUATOR_TOPIC]).notify
     self._evaluator = ScenarioEvaluator(self._conf,
                                         self._entity_graph,
                                         None,
                                         actions_callback,
                                         enabled=False)
コード例 #4
0
    def __init__(self, conf):
        super(ListenerService, self).__init__()
        self.enrich_callbacks_by_events = \
            self._create_callbacks_by_events_dict(conf)

        topics = [conf.datasources.notification_topic_collector]
        if conf.persistency.enable_persistency:
            topics.append(conf.persistency.persistor_topic)
        else:
            LOG.warning("Not persisting events")
        notifier = VitrageNotifier(conf, 'driver.events', topics)
        self.listener = self._get_topics_listener(conf, notifier.notify)
コード例 #5
0
 def _init_instance(self):
     scenario_repo = ScenarioRepository(self._conf, self.worker_id,
                                        self._workers_num)
     actions_callback = VitrageNotifier(conf=self._conf,
                                        publisher_id='vitrage_evaluator',
                                        topics=[EVALUATOR_TOPIC]).notify
     self._evaluator = ScenarioEvaluator(self._conf,
                                         self._entity_graph,
                                         scenario_repo,
                                         actions_callback,
                                         enabled=False)
     self._evaluator.scenario_repo.log_enabled_scenarios()
コード例 #6
0
ファイル: evaluator_service.py プロジェクト: pczerkas/vitrage
 def start(self):
     super(EvaluatorWorker, self).start()
     actions_callback = VitrageNotifier(conf=self._conf,
                                        publisher_id='vitrage_evaluator',
                                        topic=EVALUATOR_TOPIC).notify
     self._entity_graph.notifier._subscriptions = []  # Quick n dirty
     self._evaluator = ScenarioEvaluator(self._conf, self._entity_graph,
                                         self._scenario_repo,
                                         actions_callback, self._enabled)
     self.tg.add_thread(self._read_queue)
     LOG.info("EvaluatorWorkerService - Started!")
     self._evaluator.scenario_repo.log_enabled_scenarios()
コード例 #7
0
ファイル: rpc_service.py プロジェクト: eilatc/vitrage
    def create_async_persistor(conf):
        if not conf.persistency.enable_persistency:
            return None
        topics = [conf.persistency.persistor_topic]
        notifier = VitrageNotifier(conf, 'driver.events', topics)
        persist_worker = futures.ThreadPoolExecutor(max_workers=1)

        def do_persist(events):
            for e in events:
                notifier.notify('', e)

        def do_work(events):
            persist_worker.submit(do_persist, events)

        return do_work
コード例 #8
0
 def __init__(self, conf, entity_graph):
     super(VitrageConsistencyService, self).__init__()
     self.conf = conf
     self.entity_graph = entity_graph
     self.actions_notifier = VitrageNotifier(conf, 'vitrage_consistency',
                                             EVALUATOR_TOPIC)