def setup(self, config):
"""
Load existing data for given worker.
:param config: Configuration object.
:type config: ``dict``
"""
self.path = os.path.join(
config[helper.DATA_ROOT], '%s_buckets-%s.pickle' %
(self.NAME, config[helper.WORKER_ID]))
with open(self.path, 'a') as _:
pass
with open(self.path, 'rb') as inp:
try:
self.buckets = pickle.load(inp)
except Exception:
self.buckets = {}
config_related = config.get(helper.RELATED, {}).get(self.NAME, {})
self.min_score = config_related.get(helper.MIN_SCORE, 0.4)
self.min_shared = config_related.get(helper.MIN_SHARED, 5)
self.max_results = config_related.get(helper.MAX_RESULTS, 100)
评论列表
文章目录