diff options
author | Bryan Newbold <bnewbold@archive.org> | 2019-12-18 14:53:33 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2019-12-18 14:53:35 -0800 |
commit | 1a45fe3f3ef3122355f49470fbbcd6dc82c959b2 (patch) | |
tree | 9f9e60c2814c91ad2b394c95b5ff5c9c9345d72d /python/kafka_grobid.py | |
parent | 0ea8bfb3485bc4db5cb7a17397d6c37f407a65b4 (diff) | |
download | sandcrawler-1a45fe3f3ef3122355f49470fbbcd6dc82c959b2.tar.gz sandcrawler-1a45fe3f3ef3122355f49470fbbcd6dc82c959b2.zip |
refactor: sort keys in JSON output
This makes debugging by tailing Kafka topics a lot more readable
Diffstat (limited to 'python/kafka_grobid.py')
-rwxr-xr-x | python/kafka_grobid.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/python/kafka_grobid.py b/python/kafka_grobid.py index dd6ab63..05e48bd 100755 --- a/python/kafka_grobid.py +++ b/python/kafka_grobid.py @@ -282,7 +282,7 @@ class KafkaGrobidWorker: grobid_output.get('key'), status)) sys.stdout.flush() - producer.produce(json.dumps(grobid_output).encode('utf-8')) + producer.produce(json.dumps(grobid_output, sort_keys=True).encode('utf-8')) sequential_failures = 0 else: sys.stderr.write("failed to extract: {}\n".format(status)) |