From ee6ce29e7987f936536a0ef128d3a96cc1df3d86 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 26 Apr 2018 18:24:42 +0000 Subject: XML size limit --- mapreduce/extraction_cdx_grobid.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mapreduce/extraction_cdx_grobid.py b/mapreduce/extraction_cdx_grobid.py index 6659f61..e87da40 100755 --- a/mapreduce/extraction_cdx_grobid.py +++ b/mapreduce/extraction_cdx_grobid.py @@ -152,6 +152,12 @@ class MRExtractCdxGrobid(MRJob): return info, dict(status="error", reason="non-200 GROBID HTTP status", extra=grobid_response.text) + # 4 MByte XML size limit + if len(grobid_response.content) > 4000000: + info['grobid0:status'] = dict(description=grobid_response.text) + return info, dict(status="oversize", reason="TEI response was too large", + extra=grobid_response.text) + info['grobid0:status'] = {'status': 'success'} info['grobid0:tei_xml'] = grobid_response.content -- cgit v1.2.3