From 41c26d2b9ac215f2dacd15f6b7433b909cafb552 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 5 Jul 2018 20:35:07 +0000 Subject: monkey-patch SHA-1 blacklist --- mapreduce/extraction_cdx_grobid.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mapreduce/extraction_cdx_grobid.py') diff --git a/mapreduce/extraction_cdx_grobid.py b/mapreduce/extraction_cdx_grobid.py index 7771e45..ed82a5e 100755 --- a/mapreduce/extraction_cdx_grobid.py +++ b/mapreduce/extraction_cdx_grobid.py @@ -36,6 +36,10 @@ from grobid2json import teixml2json # Yep, a global. Gets DSN from `SENTRY_DSN` environment variable sentry_client = raven.Client() +# Specific poison-pill rows we should skip +KEY_BLACKLIST = ( + 'sha1:DLCCSMMVTCCIR6LRXHEQLZ4PWO6NG2YT', # "failed to guess ARC header format" +) class MRExtractCdxGrobid(MRJob): @@ -203,6 +207,10 @@ class MRExtractCdxGrobid(MRJob): yield _, status return key = info['key'] + if key in KEY_BLACKLIST: + self.increment_counter('lines', 'blacklist') + yield _, dict(status='blacklist', key=key) + return # Note: this may not get "cleared" correctly sentry_client.extra_context(dict(row_key=key)) -- cgit v1.2.3