Пример #1
0
 def _create_entity_vertex(self, entity_event):
     if is_update_event(entity_event) and \
             utils.opt_exists(self.conf, self.get_type()) and \
             utils.opt_exists(self.conf[self.get_type()], 'update_method'):
         update_method = self.conf[self.get_type()].update_method.lower()
         if update_method == UpdateMethod.PUSH:
             return self._create_update_entity_vertex(entity_event)
         elif update_method == UpdateMethod.PULL:
             return self._create_snapshot_entity_vertex(entity_event)
         elif update_method == UpdateMethod.NONE:
             return None
         else:
             LOG.error('Update event arrived for dataresource that is '
                       'defined without updates')
     else:
         return self._create_snapshot_entity_vertex(entity_event)
Пример #2
0
 def _register_services(self):
     return itertools.chain(
         (ChangesService(self.conf, [self.snapshot_datasources[plugin]],
                         self.conf[plugin].changes_interval, self.callback)
          for plugin in self.conf.datasources.types
          if opt_exists(self.conf[plugin], CHANGES_INTERVAL)),
         (SnapshotsService(self.conf, self.snapshot_datasources,
                           self.callback), ),
         (ListenerService(self.conf, self.snapshot_datasources,
                          self.callback), ),
     )
Пример #3
0
    def register_transformer_classes(conf):

        transformers = {}
        for datasource_type in conf.datasources.types:
            transformers[datasource_type] = importutils.import_object(
                conf[datasource_type].transformer, transformers)
            if opt_exists(conf[datasource_type], ENTITIES):
                for entity in conf[datasource_type].entities:
                    transformers[entity] = importutils.import_object(
                        conf[datasource_type].transformer, transformers)

        transformers[VITRAGE_TYPE] = importutils.import_object(
            "%s.%s" % (EvaluatorEventTransformer.__module__,
                       EvaluatorEventTransformer.__name__), transformers)

        return transformers
Пример #4
0
    def _register_services(self):
        return itertools.chain(
            (ChangesService(self.conf,
                            [self.snapshot_datasources[plugin]],
                            self.conf[plugin].changes_interval,
                            self.callback)

                for plugin in self.conf.datasources.types
                if opt_exists(self.conf[plugin], CHANGES_INTERVAL)),

            (SnapshotsService(self.conf,
                              self.snapshot_datasources,
                              self.callback),),

            (ListenerService(self.conf,
                             self.snapshot_datasources,
                             self.callback),),)
Пример #5
0
    def register_transformer_classes(conf):

        transformers = {}
        for datasource_type in conf.datasources.types:
            transformers[datasource_type] = importutils.import_object(
                conf[datasource_type].transformer,
                transformers)
            if opt_exists(conf[datasource_type], ENTITIES):
                for entity in conf[datasource_type].entities:
                    transformers[entity] = importutils.import_object(
                        conf[datasource_type].transformer, transformers)

        transformers[VITRAGE_TYPE] = importutils.import_object(
            "%s.%s" % (EvaluatorEventTransformer.__module__,
                       EvaluatorEventTransformer.__name__), transformers)

        transformers[CONSISTENCY_DATASOURCE] = importutils.import_object(
            "%s.%s" % (ConsistencyTransformer.__module__,
                       ConsistencyTransformer.__name__), transformers)

        return transformers
Пример #6
0
 def _get_pull_datasources(conf):
     return (datasource for datasource in conf.datasources.types
             if conf[datasource].update_method.lower() == UpdateMethod.PULL
             and opt_exists(conf[datasource], CHANGES_INTERVAL))