Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/indexer.py
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | def __init__(self, config=None, **kw): | ||||
""" | """ | ||||
super().__init__() | super().__init__() | ||||
if config is not None: | if config is not None: | ||||
self.config = config | self.config = config | ||||
else: | else: | ||||
config_keys = ('base_filename', 'config_filename', | config_keys = ('base_filename', 'config_filename', | ||||
'additional_configs', 'global_config') | 'additional_configs', 'global_config') | ||||
config_args = {k: v for k, v in kw.items() if k in config_keys} | config_args = {k: v for k, v in kw.items() if k in config_keys} | ||||
if self.ADDITIONAL_CONFIG: | |||||
config_args.setdefault('additional_configs', []).append( | |||||
self.ADDITIONAL_CONFIG) | |||||
self.config = self.parse_config_file(**config_args) | self.config = self.parse_config_file(**config_args) | ||||
self.prepare() | self.prepare() | ||||
self.check() | self.check() | ||||
self.log.debug('%s: config=%s', self, self.config) | |||||
def prepare(self): | def prepare(self): | ||||
"""Prepare the indexer's needed runtime configuration. | """Prepare the indexer's needed runtime configuration. | ||||
Without this step, the indexer cannot possibly run. | Without this step, the indexer cannot possibly run. | ||||
""" | """ | ||||
config_storage = self.config.get('storage') | config_storage = self.config.get('storage') | ||||
if config_storage: | if config_storage: | ||||
▲ Show 20 Lines • Show All 468 Lines • Show Last 20 Lines |