diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-09-30 16:49:47 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-09-30 16:49:47 -0700 |
commit | f6125848f627ae9bfd3a36d807d2349e1c66bfe3 (patch) | |
tree | 8419947e17dd27621a5b17098eacaedf1a0227a5 /sql/dump_reingest_weekly.sql | |
parent | 24edc1c754d35df1020907a9c8941f16eaf71440 (diff) | |
download | sandcrawler-f6125848f627ae9bfd3a36d807d2349e1c66bfe3.tar.gz sandcrawler-f6125848f627ae9bfd3a36d807d2349e1c66bfe3.zip |
refactor reingest scripts
Diffstat (limited to 'sql/dump_reingest_weekly.sql')
-rw-r--r-- | sql/dump_reingest_weekly.sql | 81 |
1 files changed, 15 insertions, 66 deletions
diff --git a/sql/dump_reingest_weekly.sql b/sql/dump_reingest_weekly.sql index e7cd553..65800eb 100644 --- a/sql/dump_reingest_weekly.sql +++ b/sql/dump_reingest_weekly.sql @@ -3,11 +3,19 @@ COPY ( SELECT row_to_json(ingest_request.*) FROM ingest_request LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url WHERE ingest_request.ingest_type = 'pdf' - AND ingest_file_result.ingest_type = 'pdf' + AND ingest_file_result.hit = false AND ingest_request.created < NOW() - '8 hour'::INTERVAL AND ingest_request.created > NOW() - '8 day'::INTERVAL - AND ingest_file_result.hit = false - AND ingest_file_result.status like 'spn2-%' + AND (ingest_request.ingest_request_source = 'fatcat-changelog' + OR ingest_request.ingest_request_source = 'fatcat-ingest') + AND ( + ingest_file_result.status like 'spn2-%' + -- OR ingest_file_result.status like 'cdx-error' + -- OR ingest_file_result.status like 'wayback-error' + -- OR ingest_file_result.status like 'wayback-content-error' + OR ingest_file_result.status like 'petabox-error' + -- OR ingest_file_result.status like 'gateway-timeout' + ) AND ingest_file_result.status != 'spn2-error:invalid-url-syntax' AND ingest_file_result.status != 'spn2-error:filesize-limit' AND ingest_file_result.status != 'spn2-error:not-found' @@ -15,68 +23,9 @@ COPY ( AND ingest_file_result.status != 'spn2-error:too-many-redirects' AND ingest_file_result.status != 'spn2-error:network-authentication-required' AND ingest_file_result.status != 'spn2-error:unknown' -) TO '/srv/sandcrawler/tasks/reingest_weekly_spn2-error_current.rows.json'; +) TO '/srv/sandcrawler/tasks/reingest_weekly_current.rows.json'; -COPY ( - SELECT row_to_json(ingest_request.*) FROM ingest_request - LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url - WHERE ingest_request.ingest_type = 'pdf' - AND ingest_file_result.ingest_type = 'pdf' - AND ingest_file_result.hit = false - AND ingest_file_result.status like 'cdx-error' - AND ingest_request.created < NOW() - '8 hour'::INTERVAL - AND ingest_request.created > NOW() - '8 day'::INTERVAL - AND (ingest_request.ingest_request_source = 'fatcat-changelog' - OR ingest_request.ingest_request_source = 'fatcat-ingest') -) TO '/srv/sandcrawler/tasks/reingest_weekly_cdx-error_current.rows.json'; - -COPY ( - SELECT row_to_json(ingest_request.*) FROM ingest_request - LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url - WHERE ingest_request.ingest_type = 'pdf' - AND ingest_file_result.ingest_type = 'pdf' - AND ingest_file_result.hit = false - AND ingest_file_result.status like 'cdx-error' - AND ingest_request.created < NOW() - '8 hour'::INTERVAL - AND ingest_request.created > NOW() - '8 day'::INTERVAL - AND (ingest_request.ingest_request_source != 'fatcat-changelog' - AND ingest_request.ingest_request_source != 'fatcat-ingest') -) TO '/srv/sandcrawler/tasks/reingest_weekly_cdx-error_bulk_current.rows.json'; - -COPY ( - SELECT row_to_json(ingest_request.*) FROM ingest_request - LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url - WHERE ingest_request.ingest_type = 'pdf' - AND ingest_file_result.ingest_type = 'pdf' - AND ingest_file_result.hit = false - AND ingest_file_result.status like 'wayback-error' - AND ingest_request.created < NOW() - '8 hour'::INTERVAL - AND ingest_request.created > NOW() - '8 day'::INTERVAL -) TO '/srv/sandcrawler/tasks/reingest_weekly_wayback-error_current.rows.json'; - -COPY ( - SELECT row_to_json(ingest_request.*) FROM ingest_request - LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url - WHERE ingest_request.ingest_type = 'pdf' - AND ingest_file_result.ingest_type = 'pdf' - AND ingest_file_result.hit = false - AND ingest_file_result.status like 'gateway-timeout' - AND ingest_request.created < NOW() - '8 hour'::INTERVAL - AND ingest_request.created > NOW() - '8 day'::INTERVAL - AND (ingest_request.ingest_request_source = 'fatcat-changelog' - OR ingest_request.ingest_request_source = 'fatcat-ingest') -) TO '/srv/sandcrawler/tasks/reingest_weekly_gateway-timeout.rows.json'; - -COPY ( - SELECT row_to_json(ingest_request.*) FROM ingest_request - LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url - WHERE ingest_request.ingest_type = 'pdf' - AND ingest_file_result.ingest_type = 'pdf' - AND ingest_file_result.hit = false - AND ingest_file_result.status like 'petabox-error' - AND ingest_request.created < NOW() - '8 hour'::INTERVAL - AND ingest_request.created > NOW() - '8 day'::INTERVAL - AND (ingest_request.ingest_request_source = 'fatcat-changelog' - OR ingest_request.ingest_request_source = 'fatcat-ingest') -) TO '/srv/sandcrawler/tasks/reingest_weekly_petabox-error_current.rows.json'; +-- bulk re-tries would be: +-- AND (ingest_request.ingest_request_source != 'fatcat-changelog' +-- AND ingest_request.ingest_request_source != 'fatcat-ingest') |