aboutsummaryrefslogtreecommitdiffstats
path: root/sql/reingest_weekly.sh
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-08-17 13:23:59 -0700
committerBryan Newbold <bnewbold@archive.org>2020-08-17 13:23:59 -0700
commit6af81aad4c780ec5892f135a5a8e231ac08fb1e0 (patch)
tree5aa11afbfed263c2e0d9a168c70c5ceba32e5807 /sql/reingest_weekly.sh
parent095f50db138def1c52044d9feef7ce02dc709401 (diff)
downloadsandcrawler-6af81aad4c780ec5892f135a5a8e231ac08fb1e0.tar.gz
sandcrawler-6af81aad4c780ec5892f135a5a8e231ac08fb1e0.zip
WIP weekly re-ingest script
Diffstat (limited to 'sql/reingest_weekly.sh')
-rwxr-xr-xsql/reingest_weekly.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/reingest_weekly.sh b/sql/reingest_weekly.sh
new file mode 100755
index 0000000..f501b20
--- /dev/null
+++ b/sql/reingest_weekly.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/bash
+
+set -e # fail on error
+set -u # fail if variable not set in substitution
+set -o pipefail # fail if part of a '|' command fails
+
+sudo -u postgres psql < dump_reingest.sql
+
+cd ../python
+pipenv run ./scripts/ingestrequest_row2json.py /grande/snapshots//grande/snapshots/reingest_weekly_spn2-error_current.rows.json | shuf > /grande/snapshots/reingest_weekly_spn2-error_current.json
+pipenv run ./scripts/ingestrequest_row2json.py /grande/snapshots//grande/snapshots/reingest_weekly_cdx-error_current.rows.json | shuf > /grande/snapshots/reingest_weekly_cdx-error_current.json
+pipenv run ./scripts/ingestrequest_row2json.py /grande/snapshots//grande/snapshots/reingest_weekly_cdx-error_bulk_current.rows.json | shuf > /grande/snapshots/reingest_weekly_cdx-error_bulk_current.json
+pipenv run ./scripts/ingestrequest_row2json.py /grande/snapshots//grande/snapshots/reingest_weekly_wayback-error_current.rows.json | shuf > /grande/snapshots/reingest_weekly_wayback-error_current.json
+pipenv run ./scripts/ingestrequest_row2json.py /grande/snapshots//grande/snapshots/reingest_weekly_gateway-timeout.rows.json | shuf > /grande/snapshots/reingest_weekly_gateway-timeout.json
+pipenv run ./scripts/ingestrequest_row2json.py /grande/snapshots//grande/snapshots/reingest_weekly_petabox-error_current.rows.json | shuf > /grande/snapshots/reingest_weekly_petabox-error_current.json
+
+cat /grande/snapshots/reingest_weekly_spn2-error_current.json /grande/snapshots/reingest_weekly_cdx-error_current.json /grande/snapshots/reingest_weekly_wayback-error_current.json /grande/snapshots/reingest_weekly_petabox-error_current.json | shuf | jq . -c | kafkacat -P -b wbgrp-svc263.us.archive.org -t sandcrawler-prod.ingest-file-requests -p -1
+
+cat /grande/snapshots/reingest_weekly_gateway-timeout.json | shuf | jq . -c | kafkacat -P -b wbgrp-svc263.us.archive.org -t sandcrawler-prod.ingest-file-requests -p $(RANDOM % 24)
+