Пример #1
0
    def register_transformer_classes(conf):

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

            except Exception as e:
                LOG.exception('Failed to register transformer %s. '
                              'Exception: %s', datasource_type, e)

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

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

        return transformers
Пример #2
0
 def _create_entity_vertex(self, entity_event):
     if is_update_event(entity_event) and \
             opt_exists(self.conf, self.get_type()) and \
             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)
Пример #3
0
 def _create_entity_vertex(self, entity_event):
     if is_update_event(entity_event) and \
             opt_exists(self.conf, self.get_type()) and \
             opt_exists(self.conf[self.get_type()], DSOpts.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)
Пример #4
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, conf)
            if opt_exists(conf[datasource_type], ENTITIES):
                for entity in conf[datasource_type].entities:
                    transformers[entity] = importutils.import_object(
                        conf[datasource_type].transformer, transformers, conf)

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

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

        return transformers
Пример #5
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))
Пример #6
0
def get_pull_drivers_names():
    return [
        name for name in CONF.datasources.types
        if CONF[name].update_method.lower() == UpdateMethod.PULL
        and opt_exists(CONF[name], DSOpts.CHANGES_INTERVAL)
    ]
Пример #7
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], DSOpts.CHANGES_INTERVAL))