Пример #1
0
 def __init__(self, configuration):
     self.config = ExporterConfig(configuration)
     self.logger = ExportManagerLogger(self.config.log_options)
     self.module_loader = ModuleLoader()
     metadata = ExportMeta(configuration)
     self.metadata = metadata
     self.reader = self.module_loader.load_reader(
         self.config.reader_options, metadata)
     self.filter_before = self.module_loader.load_filter(
         self.config.filter_before_options, metadata)
     self.filter_after = self.module_loader.load_filter(
         self.config.filter_after_options, metadata)
     self.transform = self.module_loader.load_transform(
         self.config.transform_options, metadata)
     self.export_formatter = self.module_loader.load_formatter(
         self.config.formatter_options, metadata)
     self.writer = self.module_loader.load_writer(
         self.config.writer_options, metadata, export_formatter=self.export_formatter)
     self.persistence = self.module_loader.load_persistence(
         self.config.persistence_options, metadata)
     self.grouper = self.module_loader.load_grouper(
         self.config.grouper_options, metadata)
     self.notifiers = NotifiersList(self.config.notifiers, metadata)
     if self.config.disable_retries:
         disable_retries()
     self.logger.debug('{} has been initiated'.format(self.__class__.__name__))
     self.stats_manager = self.module_loader.load_stats_manager(
         self.config.stats_options, metadata)
     self.bypass_cases = []
Пример #2
0
    def test_should_disable_retries(self):
        count_holder = [0]

        @retry_short
        def buggy():
            count_holder[0] += 1
            raise RuntimeError('oops')

        disable_retries()

        with self.assertRaisesRegexp(RuntimeError, "oops"):
            buggy()

        self.assertEqual(count_holder[0], 1, "We should do only 1 attempt")
Пример #3
0
    def test_should_disable_retries(self):
        count_holder = [0]

        @retry_short
        def buggy():
            count_holder[0] += 1
            raise RuntimeError('oops')

        disable_retries()

        with self.assertRaisesRegexp(RuntimeError, "oops"):
            buggy()

        self.assertEqual(count_holder[0], 1, "We should do only 1 attempt")
Пример #4
0
 def __init__(self, configuration):
     self.config = ExporterConfig(configuration)
     self.threaded = self.config.exporter_options.get('threaded', False)
     self.logger = ExportManagerLogger(self.config.log_options)
     self.module_loader = ModuleLoader()
     metadata = ExportMeta(configuration)
     self.metadata = metadata
     self.reader = self.module_loader.load_reader(
         self.config.reader_options, metadata)
     if is_stream_reader(self.reader):
         deserializer = self.module_loader.load_deserializer(
             self.config.deserializer_options, metadata)
         decompressor = self.module_loader.load_decompressor(
             self.config.decompressor_options, metadata)
         self.reader.deserializer = deserializer
         self.reader.decompressor = decompressor
     self.filter_before = self.module_loader.load_filter(
         self.config.filter_before_options, metadata)
     self.filter_after = self.module_loader.load_filter(
         self.config.filter_after_options, metadata)
     self.transform = self.module_loader.load_transform(
         self.config.transform_options, metadata)
     self.export_formatter = self.module_loader.load_formatter(
         self.config.formatter_options, metadata)
     self.writer = self.module_loader.load_writer(
         self.config.writer_options,
         metadata,
         export_formatter=self.export_formatter)
     self.persistence = self.module_loader.load_persistence(
         self.config.persistence_options, metadata)
     self.grouper = self.module_loader.load_grouper(
         self.config.grouper_options, metadata)
     self.notifiers = NotifiersList(self.config.notifiers, metadata)
     if self.config.disable_retries:
         disable_retries()
     self.logger.debug('{} has been initiated'.format(
         self.__class__.__name__))
     self.stats_manager = self.module_loader.load_stats_manager(
         self.config.stats_options, metadata)
     self.bypass_cases = []