Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/indexer.py
Show First 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | def __init__(self): | ||||
self.prepare() | self.prepare() | ||||
self.check() | self.check() | ||||
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. | ||||
""" | """ | ||||
# HACK to deal with edge case (e.g revision metadata indexer) | |||||
if not hasattr(self, 'config'): | |||||
self.config = self.parse_config_file( | self.config = self.parse_config_file( | ||||
additional_configs=[self.ADDITIONAL_CONFIG]) | additional_configs=[self.ADDITIONAL_CONFIG]) | ||||
if self.config['storage']: | if self.config['storage']: | ||||
self.storage = get_storage(**self.config['storage']) | self.storage = get_storage(**self.config['storage']) | ||||
objstorage = self.config['objstorage'] | objstorage = self.config['objstorage'] | ||||
self.objstorage = get_objstorage(objstorage['cls'], objstorage['args']) | self.objstorage = get_objstorage(objstorage['cls'], objstorage['args']) | ||||
idx_storage = self.config[INDEXER_CFG_KEY] | idx_storage = self.config[INDEXER_CFG_KEY] | ||||
self.idx_storage = get_indexer_storage(**idx_storage) | self.idx_storage = get_indexer_storage(**idx_storage) | ||||
_log = logging.getLogger('requests.packages.urllib3.connectionpool') | _log = logging.getLogger('requests.packages.urllib3.connectionpool') | ||||
▲ Show 20 Lines • Show All 421 Lines • Show Last 20 Lines |