(String key, WebPage page, Context context)
| 116 | } |
| 117 | |
| 118 | @Override |
| 119 | public void map(String key, WebPage page, Context context) |
| 120 | throws IOException, InterruptedException { |
| 121 | String unreverseKey = TableUtil.unreverseUrl(key); |
| 122 | if (batchId.equals(REPARSE)) { |
| 123 | LOG.debug("Reparsing " + unreverseKey); |
| 124 | } else { |
| 125 | if (Mark.FETCH_MARK.checkMark(page) == null) { |
| 126 | if (LOG.isDebugEnabled()) { |
| 127 | LOG.debug("Skipping {}, not fetched yet", unreverseKey); |
| 128 | } |
| 129 | return; |
| 130 | } |
| 131 | if (shouldResume && Mark.PARSE_MARK.checkMark(page) != null) { |
| 132 | if (force) { |
| 133 | LOG.info("Forced parsing " + unreverseKey + "; already parsed"); |
| 134 | } else { |
| 135 | LOG.info("Skipping " + unreverseKey + "; already parsed"); |
| 136 | return; |
| 137 | } |
| 138 | } else { |
| 139 | LOG.info("Parsing " + unreverseKey); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | if (skipTruncated && isTruncated(unreverseKey, page)) { |
| 144 | return; |
| 145 | } |
| 146 | |
| 147 | if (sitemap && URLFilters.isSitemap(page)) { |
| 148 | LOG.info("Parsing for sitemap"); //TODO this log should be top line |
| 149 | parseUtil.processSitemapParse(unreverseKey, page, context); |
| 150 | } else { |
| 151 | parseUtil.process(unreverseKey, page); |
| 152 | } |
| 153 | ParseStatus pstatus = page.getParseStatus(); |
| 154 | if (pstatus != null) { |
| 155 | context.getCounter("ParserStatus", |
| 156 | ParseStatusCodes.majorCodes[pstatus.getMajorCode()]).increment(1); |
| 157 | } |
| 158 | |
| 159 | context.write(key, page); |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | public ParserJob() { |
nothing calls this directly
no test coverage detected