-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tim Reichelt
committed
Aug 10, 2017
1 parent
6670c94
commit 0541a36
Showing
9 changed files
with
157 additions
and
1,888 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
# Exit as soon as any command fails. | ||
set -e | ||
set -o pipefail | ||
|
||
# Parallel command: | ||
# cat language.codes | parallel ./dedupe.sh ${infile} ${outdir} {} ${previous_deduped} | ||
|
||
DEDUPE_BIN=/fs/zisa0/tim/dev/preprocess/bin/commoncrawl_dedupe | ||
|
||
INFILE="$1" | ||
OUTDIR="$2" | ||
LANGUAGE="$3" | ||
PREVIOUS_DEDUPED="$4" | ||
|
||
OUTFILE="${OUTDIR}/${LANGUAGE}.deduped.xz" | ||
DONEFILE="${OUTFILE}.done" | ||
|
||
if [[ -f ${DONEFILE} ]]; then | ||
exit 0 | ||
fi | ||
|
||
if [[ -f ${DEDUPEDFILE} ]]; then | ||
xz -cd "${INFILE}" | ${DEDUPE_BIN} "${PREVIOUS_DEDUPED}" | xz -c > "${OUTFILE}" | ||
else | ||
xz -cd "${INFILE}" | ${DEDUPE_BIN} /dev/null | xz -c > "${OUTFILE}" | ||
fi | ||
|
||
touch "${DONEFILE}" | ||
|
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -o pipefail | ||
|
||
# Parallel command: | ||
# seq 0 99 | parallel ./dedupe_from_shard.sh {} ${shard_dir} ${previous_deduped_dir} ${out_dir} | ||
|
||
DEDUPE_BIN=/fs/zisa0/tim/dev/preprocess/bin/commoncrawl_dedupe | ||
|
||
# Non-zero padded id. | ||
ID="$1" | ||
SHARD_DIR="$2" | ||
PREVIOUS_DEDUPED_DIR="$3" | ||
OUT_DIR="$4" | ||
|
||
# The sharded from https://github.com/kpu/preprocess uses non-zero padded ids for the shard. But the | ||
# deduped files uses zero padded ids. | ||
PADDED_ID=$(printf "%02d" ${ID}) | ||
INPUT_FILE="${SHARD_DIR}/en.tmp${ID}.gz" | ||
OUTPUT_FILE="${OUT_DIR}/en.${PADDED_ID}.deduped.xz" | ||
DONEFILE="${OUTPUT_FILE}.done" | ||
|
||
PREVIOUS_DEDUPED_FILE="${PREVIOUS_DEDUPED_DIR}/en.${PADDED_ID}.deduped.xz" | ||
|
||
if [[ -f "${DONEFILE}" ]]; then | ||
exit 0 | ||
fi | ||
|
||
|
||
gzip -cd "${INPUT_FILE}" | ${DEDUPE_BIN} "${PREVIOUS_DEDUPED_FILE}" | xz > "${OUTPUT_FILE}" | ||
|
||
touch "${DONEFILE}" |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
# Exit as soon as any command fails. | ||
set -e | ||
set -o pipefail | ||
|
||
# Parallel command: | ||
# cat language.codes | parallel ./dedupe_hash_table.sh ${infile} ${outdir} {} ${src_hash_table} ${out_hash_table} ${previous_deduped} | ||
|
||
DEDUPE_BIN=/fs/zisa/tim/dev/preprocess/bin/commoncrawl_dedupe_save_table | ||
|
||
INFILE="$1" | ||
OUTDIR="$2" | ||
LANGUAGE="$3" | ||
SRC_HASH_TABLE="$4" | ||
OUT_HASH_TABLE="$5" | ||
PREVIOUS_DEDUPED="$6" | ||
|
||
OUTFILE="${OUTDIR}/${LANGUAGE}.deduped.xz" | ||
DONEFILE="${OUTFILE}.done" | ||
|
||
if [[ -f ${DONEFILE} ]]; then | ||
exit 0 | ||
fi | ||
|
||
if [[ -f ${PREVIOUS_DEDUPED} ]]; then | ||
xz -cd ${INFILE} | ${DEDUPE_BIN} "${PREVIOUS_DEDUPED}" "${SRC_HASH_TABLE}" "${OUT_HASH_TABLE}" | \ | ||
/fs/zisa0/tim/bin/xz -T 6 -c > "${OUTFILE}" | ||
else | ||
xz -cd ${INFILE} | ${DEDUPE_BIN} /dev/null "${SRC_HASH_TABLE}" "${OUT_HASH_TABLE}" | \ | ||
/fs/zisa0/tim/bin/xz -T 6 -c > "${OUTFILE}" | ||
fi | ||
|
||
touch "${DONEFILE}" | ||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# Exit as soon as any command fails. | ||
set -e | ||
set -o pipefail | ||
|
||
DEDUPED="$1" | ||
NEW_DEDUPED="$2" | ||
OFFSET_FILE="$3" | ||
CRAWL_ID="$4" | ||
|
||
# NOTE: Offset file format (one file for each language). Offset shows where each crawl ends. | ||
# Each crawl begins at the offset from the previous line. | ||
# {Crawl_ID} {offset1} | ||
# {Crawl_ID} {offset2} | ||
|
||
# Concat old deduped and new deduped. | ||
cat "${NEW_DEDUPED}" >> "${DEDUPED}" | ||
|
||
# Write new size to offset file. | ||
NEW_SIZE=$(stat --printf="%s" "${DEDUPED}") | ||
echo "${CRAWL_ID} ${NEW_SIZE}" >> "${OFFSET_FILE}" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.