From c7cc6c6c48dc5b9d1cbcb9abdb287aa7e63832e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20DA=20ROCHA?= <sebastien@da-rocha.net> Date: Fri, 4 Dec 2020 11:40:53 +0100 Subject: [PATCH] allow sample generation if no source_url specified (reindex on same host) --- workers/sample_generator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/workers/sample_generator.py b/workers/sample_generator.py index d86d5f3..82dd4e9 100644 --- a/workers/sample_generator.py +++ b/workers/sample_generator.py @@ -30,7 +30,10 @@ def callback(channel, method, properties, body): #data = res.json() # get sample records from the ingest index - source_es = Elasticsearch([cfg['reindexer']['source_url']], timeout=60) + if 'source_url' in cfg['reindexer'].keys(): + source_es = Elasticsearch([cfg['reindexer']['source_url']], timeout=60) + else: + source_es = Elasticsearch([cfg['reindexer']['destination_url']], timeout=60) the_query = dict() the_query['size'] = sample_size -- GitLab