aboutsummaryrefslogtreecommitdiffstats
path: root/mapreduce/extraction_cdx_grobid.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2018-07-05 20:35:07 +0000
committerBryan Newbold <bnewbold@archive.org>2018-07-05 20:35:07 +0000
commit41c26d2b9ac215f2dacd15f6b7433b909cafb552 (patch)
tree65d18e7187cf48381382be4df1f5d32e6338ee8c /mapreduce/extraction_cdx_grobid.py
parent8cc18540e2663ab02428c15c2e1f17fe5624e1aa (diff)
downloadsandcrawler-41c26d2b9ac215f2dacd15f6b7433b909cafb552.tar.gz
sandcrawler-41c26d2b9ac215f2dacd15f6b7433b909cafb552.zip
monkey-patch SHA-1 blacklist
Diffstat (limited to 'mapreduce/extraction_cdx_grobid.py')
-rwxr-xr-xmapreduce/extraction_cdx_grobid.py8
1 files changed, 8 insertions, 0 deletions
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))