diff --git a/swh/indexer/orchestrator.py b/swh/indexer/orchestrator.py --- a/swh/indexer/orchestrator.py +++ b/swh/indexer/orchestrator.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2017 The Software Heritage developers +# Copyright (C) 2016-2018 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information @@ -68,8 +68,9 @@ }), } - def prepare(self): - super().prepare() + def __init__(self): + super().__init__() + self.config = self.parse_config_file() self.prepare_tasks() def prepare_tasks(self): diff --git a/swh/indexer/tests/test_orchestrator.py b/swh/indexer/tests/test_orchestrator.py --- a/swh/indexer/tests/test_orchestrator.py +++ b/swh/indexer/tests/test_orchestrator.py @@ -102,20 +102,19 @@ super().__init__() self.running_tasks = [] - def prepare(self): - self.config = { - 'indexers': { - 'indexer1': { - 'batch_size': 2, - 'check_presence': True, - }, - 'indexer2': { - 'batch_size': 2, - 'check_presence': True, - }, - } - } - self.prepare_tasks() + def parse_config_file(self): + return { + 'indexers': { + 'indexer1': { + 'batch_size': 2, + 'check_presence': True, + }, + 'indexer2': { + 'batch_size': 2, + 'check_presence': True, + }, + } + } class MockedTestOrchestrator12(TestOrchestrator12): @@ -127,7 +126,6 @@ def test_orchestrator_filter(self): with start_worker_thread(): o = TestOrchestrator12() - o.prepare() promises = o.run(['id12', 'id2']) results = [] for promise in reversed(promises): @@ -146,7 +144,6 @@ def test_mocked_orchestrator_filter(self): o = MockedTestOrchestrator12() - o.prepare() o.run(['id12', 'id2']) self.assertCountEqual(o.running_tasks, [ {'args': (), @@ -169,7 +166,6 @@ def test_mocked_orchestrator_batch(self): o = MockedTestOrchestrator12() - o.prepare() o.run(['id12', 'id2a', 'id2b', 'id2c']) self.assertCountEqual(o.running_tasks, [ {'args': (),