-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Chronos job to do HDFS -> ElasticSearch monthly
This adds a Chronos job to do a reindex of the targetsmart data once a month. To fit in 1 GB of memory, I reduced the bulk index size of voters from 1,000,000 -> 100,000. Change-Id: Ic6cec051930f6e2cce8b5e7929aebe9df2ffb8d1 Reviewed-on: https://code.brigade.com/6775 Tested-by: Leeroy Jenkins <[email protected]> Reviewed-by: John Miller <[email protected]> Reviewed-by: Shane da Silva <[email protected]>
- Loading branch information
Showing
4 changed files
with
43 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,13 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
set -exuo pipefail | ||
|
||
echo "Finding total number of records..." >&2 | ||
# Cached value from running the below command: | ||
total=228459351 | ||
***REMOVED*** | ||
# --user=brigade_media --password=$TARGETSMART_PASSWORD -O - | awk '{ sum+=$1} END {print sum}') | ||
echo "... ${total} records" >&2 | ||
|
||
for FILE in $(python list_files.py); do | ||
total=230000000 # <- approximately correct value: | ||
for FILE in $(env/bin/python list_files.py); do | ||
echo "Processing file $(basename $FILE)..." >&2 | ||
wget \ | ||
--timeout 900 \ | ||
--output-document - \ | ||
--quiet \ | ||
$FILE \ | ||
| gunzip | ||
done | pv -l -s $total | python index.py $total | ||
done | pv -l -s $total | env/bin/python index.py $total |