chore: import upstream snapshot with attribution
CI / lint (3.11) (push) Has been cancelled
CI / lint (3.12) (push) Has been cancelled
CI / lint (3.13) (push) Has been cancelled
CI / shellcheck (push) Has been cancelled
CI / shfmt (push) Has been cancelled
CI / setup (3.11) (push) Has been cancelled
CI / setup (3.12) (push) Has been cancelled
CI / setup (3.13) (push) Has been cancelled
CI / check-licenses (3.12) (push) Has been cancelled
CI / test_unit (3.11) (push) Has been cancelled
CI / test_unit (3.12) (push) Has been cancelled
CI / test_unit (3.13) (push) Has been cancelled
CI / test_unit_no_extras (3.11) (push) Has been cancelled
CI / test_unit_no_extras (3.12) (push) Has been cancelled
CI / test_json_to_html (3.12) (push) Has been cancelled
CI / test_unit_no_extras (3.13) (push) Has been cancelled
CI / test_unit_dependency_extras (csv, 3.12, --extra csv) (push) Has been cancelled
CI / test_unit_dependency_extras (xlsx, 3.11, --extra xlsx) (push) Has been cancelled
CI / test_unit_dependency_extras (xlsx, 3.12, --extra xlsx) (push) Has been cancelled
CI / test_unit_dependency_extras (csv, 3.11, --extra csv) (push) Has been cancelled
CI / test_unit_dependency_extras (csv, 3.13, --extra csv) (push) Has been cancelled
CI / test_unit_dependency_extras (docx, 3.11, --extra docx) (push) Has been cancelled
CI / test_unit_dependency_extras (docx, 3.12, --extra docx) (push) Has been cancelled
CI / test_unit_dependency_extras (docx, 3.13, --extra docx) (push) Has been cancelled
CI / test_unit_dependency_extras (markdown, 3.11, --extra md) (push) Has been cancelled
CI / test_unit_dependency_extras (markdown, 3.12, --extra md) (push) Has been cancelled
CI / test_unit_dependency_extras (markdown, 3.13, --extra md) (push) Has been cancelled
CI / test_unit_dependency_extras (odt, 3.11, --extra odt) (push) Has been cancelled
CI / test_unit_dependency_extras (odt, 3.12, --extra odt) (push) Has been cancelled
CI / test_unit_dependency_extras (odt, 3.13, --extra odt) (push) Has been cancelled
CI / test_unit_dependency_extras (pdf-image, 3.11, --extra pdf --extra image --extra paddleocr) (push) Has been cancelled
CI / test_unit_dependency_extras (pdf-image, 3.12, --extra pdf --extra image --extra paddleocr) (push) Has been cancelled
CI / test_unit_dependency_extras (pdf-image, 3.13, --extra pdf --extra image --extra paddleocr) (push) Has been cancelled
CI / test_unit_dependency_extras (pptx, 3.11, --extra pptx) (push) Has been cancelled
CI / test_unit_dependency_extras (pptx, 3.12, --extra pptx) (push) Has been cancelled
CI / test_unit_dependency_extras (pptx, 3.13, --extra pptx) (push) Has been cancelled
CI / test_unit_dependency_extras (pypandoc, 3.11, --extra epub --extra org --extra rtf --extra rst) (push) Has been cancelled
CI / test_unit_dependency_extras (pypandoc, 3.12, --extra epub --extra org --extra rtf --extra rst) (push) Has been cancelled
CI / test_unit_dependency_extras (pypandoc, 3.13, --extra epub --extra org --extra rtf --extra rst) (push) Has been cancelled
Build And Push Docker Image / set-short-sha (push) Has been cancelled
Partition Benchmark / setup (push) Has been cancelled
Partition Benchmark / Measure and compare partition() runtime (push) Has been cancelled
CI / test_unit_dependency_extras (xlsx, 3.13, --extra xlsx) (push) Has been cancelled
CI / test_ingest_src (3.12) (push) Has been cancelled
CI / test_json_to_markdown (3.12) (push) Has been cancelled
CI / changelog (push) Has been cancelled
CI / test_dockerfile (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Build And Push Docker Image / build-images (linux/amd64, opensource-linux-8core) (push) Has been cancelled
Build And Push Docker Image / build-images (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Build And Push Docker Image / publish-images (push) Has been cancelled
CI / lint (3.11) (push) Has been cancelled
CI / lint (3.12) (push) Has been cancelled
CI / lint (3.13) (push) Has been cancelled
CI / shellcheck (push) Has been cancelled
CI / shfmt (push) Has been cancelled
CI / setup (3.11) (push) Has been cancelled
CI / setup (3.12) (push) Has been cancelled
CI / setup (3.13) (push) Has been cancelled
CI / check-licenses (3.12) (push) Has been cancelled
CI / test_unit (3.11) (push) Has been cancelled
CI / test_unit (3.12) (push) Has been cancelled
CI / test_unit (3.13) (push) Has been cancelled
CI / test_unit_no_extras (3.11) (push) Has been cancelled
CI / test_unit_no_extras (3.12) (push) Has been cancelled
CI / test_json_to_html (3.12) (push) Has been cancelled
CI / test_unit_no_extras (3.13) (push) Has been cancelled
CI / test_unit_dependency_extras (csv, 3.12, --extra csv) (push) Has been cancelled
CI / test_unit_dependency_extras (xlsx, 3.11, --extra xlsx) (push) Has been cancelled
CI / test_unit_dependency_extras (xlsx, 3.12, --extra xlsx) (push) Has been cancelled
CI / test_unit_dependency_extras (csv, 3.11, --extra csv) (push) Has been cancelled
CI / test_unit_dependency_extras (csv, 3.13, --extra csv) (push) Has been cancelled
CI / test_unit_dependency_extras (docx, 3.11, --extra docx) (push) Has been cancelled
CI / test_unit_dependency_extras (docx, 3.12, --extra docx) (push) Has been cancelled
CI / test_unit_dependency_extras (docx, 3.13, --extra docx) (push) Has been cancelled
CI / test_unit_dependency_extras (markdown, 3.11, --extra md) (push) Has been cancelled
CI / test_unit_dependency_extras (markdown, 3.12, --extra md) (push) Has been cancelled
CI / test_unit_dependency_extras (markdown, 3.13, --extra md) (push) Has been cancelled
CI / test_unit_dependency_extras (odt, 3.11, --extra odt) (push) Has been cancelled
CI / test_unit_dependency_extras (odt, 3.12, --extra odt) (push) Has been cancelled
CI / test_unit_dependency_extras (odt, 3.13, --extra odt) (push) Has been cancelled
CI / test_unit_dependency_extras (pdf-image, 3.11, --extra pdf --extra image --extra paddleocr) (push) Has been cancelled
CI / test_unit_dependency_extras (pdf-image, 3.12, --extra pdf --extra image --extra paddleocr) (push) Has been cancelled
CI / test_unit_dependency_extras (pdf-image, 3.13, --extra pdf --extra image --extra paddleocr) (push) Has been cancelled
CI / test_unit_dependency_extras (pptx, 3.11, --extra pptx) (push) Has been cancelled
CI / test_unit_dependency_extras (pptx, 3.12, --extra pptx) (push) Has been cancelled
CI / test_unit_dependency_extras (pptx, 3.13, --extra pptx) (push) Has been cancelled
CI / test_unit_dependency_extras (pypandoc, 3.11, --extra epub --extra org --extra rtf --extra rst) (push) Has been cancelled
CI / test_unit_dependency_extras (pypandoc, 3.12, --extra epub --extra org --extra rtf --extra rst) (push) Has been cancelled
CI / test_unit_dependency_extras (pypandoc, 3.13, --extra epub --extra org --extra rtf --extra rst) (push) Has been cancelled
Build And Push Docker Image / set-short-sha (push) Has been cancelled
Partition Benchmark / setup (push) Has been cancelled
Partition Benchmark / Measure and compare partition() runtime (push) Has been cancelled
CI / test_unit_dependency_extras (xlsx, 3.13, --extra xlsx) (push) Has been cancelled
CI / test_ingest_src (3.12) (push) Has been cancelled
CI / test_json_to_markdown (3.12) (push) Has been cancelled
CI / changelog (push) Has been cancelled
CI / test_dockerfile (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Build And Push Docker Image / build-images (linux/amd64, opensource-linux-8core) (push) Has been cancelled
Build And Push Docker Image / build-images (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Build And Push Docker Image / publish-images (push) Has been cancelled
This commit is contained in:
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z "$UNS_API_KEY" ]; then
|
||||
echo "Skipping ingest test against api because the UNS_API_KEY env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=api-ingest-output
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
TEST_FILE_NAME=layout-parser-paper-with-table.pdf
|
||||
|
||||
# including pdf-infer-table-structure to validate partition arguments are passed to the api
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
local \
|
||||
--api-key "$UNS_API_KEY" \
|
||||
--metadata-exclude coordinates,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--partition-by-api \
|
||||
--strategy hi_res \
|
||||
--chunking-strategy by_page \
|
||||
--chunk-max-characters 10000 \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--num-processes "$max_processes" \
|
||||
--input-path "example-docs/pdf/$TEST_FILE_NAME" \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
RESULT_FILE_PATH="$OUTPUT_DIR/$TEST_FILE_NAME.json"
|
||||
# validate that there is at least one table with text_as_html in the results
|
||||
if [ "$(jq 'any(.[]; .metadata.text_as_html != null)' "$RESULT_FILE_PATH")" = "false" ]; then
|
||||
echo "No table with text_as_html found in $RESULT_FILE_PATH but at least one was expected."
|
||||
exit 1
|
||||
fi
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Description: This test checks if all the processed content is the same as the expected outputs.
|
||||
# Also checks if a large table can be ingested properly.
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
|
||||
OUTPUT_FOLDER_NAME=airtable-diff
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
CI=${CI:-"false"}
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
VARIED_DATA_BASE_ID="app5YQxSfp220fWtm"
|
||||
VARIED_DATA_BASE_ID_2="appJ43QmP8I17zu88"
|
||||
|
||||
if [ -z "$AIRTABLE_PERSONAL_ACCESS_TOKEN" ]; then
|
||||
echo "Skipping Airtable ingest test because the AIRTABLE_PERSONAL_ACCESS_TOKEN is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
airtable \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--personal-access-token "$AIRTABLE_PERSONAL_ACCESS_TOKEN" \
|
||||
--list-of-paths "$VARIED_DATA_BASE_ID $VARIED_DATA_BASE_ID_2" \
|
||||
--metadata-exclude filename,file_directory,metadata.data_source.date_processed,metadata.date,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth,metadata.languages \
|
||||
--num-processes "$max_processes" \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--work-dir "$WORK_DIR" \
|
||||
--verbose \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Description: This test checks if the number of bases and tables processed are as expected.
|
||||
# Each base shows up as a directory in the output folder, hence check-num-dirs-output.sh
|
||||
# Each table shows up as a file in a base directory, hence check-num-files-output.sh
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
|
||||
OUTPUT_FOLDER_NAME=airtable-large
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$AIRTABLE_PERSONAL_ACCESS_TOKEN" ]; then
|
||||
echo "Skipping Airtable ingest test because the AIRTABLE_PERSONAL_ACCESS_TOKEN is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
# Provides component IDs such as LARGE_TEST_LIST_OF_PATHS,
|
||||
# LARGE_TABLE_BASE_ID, LARGE_TABLE_TABLE_ID, and LARGE_BASE_BASE_ID
|
||||
# shellcheck disable=SC1091
|
||||
source ./scripts/airtable-test-helpers/component_ids.sh
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
airtable \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--personal-access-token "$AIRTABLE_PERSONAL_ACCESS_TOKEN" \
|
||||
--list-of-paths "$LARGE_TEST_LIST_OF_PATHS" \
|
||||
--metadata-exclude filename,file_directory,metadata.data_source.date_processed,metadata.date,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
# We are expecting fifteen directories: fourteen bases and the parent directory
|
||||
"$SCRIPT_DIR"/check-num-dirs-output.sh 15 "$OUTPUT_FOLDER_NAME"
|
||||
|
||||
# We are expecting 101 files: 100 tables and the parent directory
|
||||
"$SCRIPT_DIR"/check-num-files-output.sh 101 "$OUTPUT_FOLDER_NAME"/"$LARGE_BASE_BASE_ID"/
|
||||
|
||||
# Test on ingesting a large number of bases
|
||||
for i in {1..12}; do
|
||||
var="LARGE_WORKSPACE_BASE_ID_$i"
|
||||
"$SCRIPT_DIR"/check-num-files-output.sh 12 "$OUTPUT_FOLDER_NAME"/"${!var}"
|
||||
done
|
||||
|
||||
# Test on ingesting a table with lots of rows
|
||||
"$SCRIPT_DIR"/check-num-rows-and-columns-output.sh 39999 "$OUTPUT_DIR"/"$LARGE_TABLE_BASE_ID"/"$LARGE_TABLE_TABLE_ID".json
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=astradb
|
||||
OUTPUT_DIR=$SCRIPT_DIR/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$SCRIPT_DIR/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
if [ -z "$ASTRA_DB_APPLICATION_TOKEN" ]; then
|
||||
echo "Skipping Astra DB source test because ASTRA_DB_APPLICATION_TOKEN env var is not set."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "$ASTRA_DB_API_ENDPOINT" ]; then
|
||||
echo "Skipping Astra DB source test because ASTRA_DB_API_ENDPOINT env var is not set."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
COLLECTION_NAME="ingest_test_src"
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
astradb \
|
||||
--token "$ASTRA_DB_APPLICATION_TOKEN" \
|
||||
--api-endpoint "$ASTRA_DB_API_ENDPOINT" \
|
||||
--collection-name "$COLLECTION_NAME" \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.last_modified,metadata.data_source.date_processed,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--strategy hi_res \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# shellcheck disable=SC2329 # Functions are invoked indirectly
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=azure
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
# shellcheck disable=SC2317
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
azure \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.last_modified,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--strategy hi_res \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--account-name azureunstructured1 \
|
||||
--remote-url abfs://container1/ \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
EXIT_CODE=$?
|
||||
set -e
|
||||
|
||||
if [ "$EXIT_CODE" -ne 0 ]; then
|
||||
echo "The last script run exited with a non-zero exit code: $EXIT_CODE."
|
||||
# Handle the error or exit
|
||||
fi
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
|
||||
exit $EXIT_CODE
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2317
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=biomed-api
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
"$SCRIPT_DIR"/check-num-files-expected-output.sh 2 $OUTPUT_FOLDER_NAME 10k
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
biomed \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.last_modified,metadata.data_source.date_processed,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--strategy hi_res \
|
||||
--preserve-downloads \
|
||||
--re-download \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--api-from "2019-01-02" \
|
||||
--api-until "2019-01-02+00:03:10" \
|
||||
--max-request-time 30 \
|
||||
--max-retries 5 \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2317
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=biomed-path
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
"$SCRIPT_DIR"/check-num-files-expected-output.sh 1 $OUTPUT_FOLDER_NAME 10k
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
biomed \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.last_modified,metadata.data_source.date_processed,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--strategy hi_res \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--max-request-time 30 \
|
||||
--max-retries 5 \
|
||||
--path "oa_pdf/07/07/sbaa031.073.PMC7234218.pdf" \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Set either BOX_APP_CONFIG (app config json content as string) or
|
||||
# BOX_APP_CONFIG_PATH (path to app config json file) env var
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=box
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$BOX_APP_CONFIG" ] && [ -z "$BOX_APP_CONFIG_PATH" ]; then
|
||||
echo "Skipping Box ingest test because neither BOX_APP_CONFIG nor BOX_APP_CONFIG_PATH env vars are set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
if [ -z "$BOX_APP_CONFIG_PATH" ]; then
|
||||
# Create temporary service key file
|
||||
BOX_APP_CONFIG_PATH=$(mktemp)
|
||||
echo "$BOX_APP_CONFIG" >"$BOX_APP_CONFIG_PATH"
|
||||
fi
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
box \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--box-app-config $(cat "$BOX_APP_CONFIG_PATH") \
|
||||
--remote-url box://utic-test-ingest-fixtures \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--preserve-downloads \
|
||||
--recursive \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Description: This test checks if all the processed content is the same as the expected outputs
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
|
||||
OUTPUT_FOLDER_NAME=confluence-diff
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$CONFLUENCE_USER_EMAIL" ] || [ -z "$CONFLUENCE_API_TOKEN" ]; then
|
||||
echo "Skipping Confluence ingest test because the CONFLUENCE_USER_EMAIL or CONFLUENCE_API_TOKEN env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
confluence \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude filename,file_directory,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--url https://unstructured-ingest-test.atlassian.net \
|
||||
--user-email "$CONFLUENCE_USER_EMAIL" \
|
||||
--api-token "$CONFLUENCE_API_TOKEN" \
|
||||
--spaces testteamsp,MFS \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Description: This test checks if the number of spaces and documents processed are as expected.
|
||||
# Each space shows up as a directory in the output folder, hence check-num-dirs-output.sh
|
||||
# Each document shows up as a file in a space directory, hence check-num-files-output.sh
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
|
||||
OUTPUT_FOLDER_NAME=confluence-large
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$CONFLUENCE_USER_EMAIL" ] || [ -z "$CONFLUENCE_API_TOKEN" ]; then
|
||||
echo "Skipping Confluence ingest test because the CONFLUENCE_USER_EMAIL or CONFLUENCE_API_TOKEN env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
# The test checks the scenario where --confluence-list-of-spaces and --confluence-num-of-spaces
|
||||
# are being provided at the same time, which is a wrong way to use the connector.
|
||||
|
||||
# We expect the test to ignore --confluence-num-of-spaces and use --confluence-list-of-spaces.
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
confluence \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude filename,file_directory,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--url https://unstructured-ingest-test.atlassian.net \
|
||||
--user-email "$CONFLUENCE_USER_EMAIL" \
|
||||
--api-token "$CONFLUENCE_API_TOKEN" \
|
||||
--max-num-of-spaces 10 \
|
||||
--spaces testteamsp1 \
|
||||
--max-num-of-docs-from-each-space 250 \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
OUTPUT_SUBFOLDER_NAME=testteamsp1
|
||||
|
||||
# We are expecting two directories: one for the space, and one is the output directory itself
|
||||
# Example:
|
||||
# Output dir: unstructured/test_unstructured_ingest/structured-output/confluence-large
|
||||
# Space dir: unstructured/test_unstructured_ingest/structured-output/confluence-large/testteamsp1
|
||||
"$SCRIPT_DIR"/check-num-dirs-output.sh 2 "$OUTPUT_FOLDER_NAME"
|
||||
|
||||
# We are expecting 250 files due to the --confluence-num-of-docs-from-each-space 250 that we provided.
|
||||
"$SCRIPT_DIR"/check-num-files-output.sh 250 "$OUTPUT_FOLDER_NAME"/"$OUTPUT_SUBFOLDER_NAME"/
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=delta-table
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
if [ -z "$AWS_ACCESS_KEY_ID" ] && [ -z "$AWS_SECRET_ACCESS_KEY" ]; then
|
||||
echo "Skipping Delta Table ingest test because either AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY env var was not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
delta-table \
|
||||
--num-processes "$max_processes" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_processed,metadata.data_source.date_created,metadata.last_modified,metadata.date_created,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--table-uri s3://utic-dev-tech-fixtures/sample-delta-lake-data/deltatable/ \
|
||||
--storage_options "{\"AWS_REGION\":\"us-east-2\",\"AWS_ACCESS_KEY_ID\":\"$AWS_ACCESS_KEY_ID\",\"AWS_SECRET_ACCESS_KEY\":\"$AWS_SECRET_ACCESS_KEY\"}" \
|
||||
--preserve-downloads \
|
||||
--verbose \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=discord
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$DISCORD_TOKEN" ]; then
|
||||
echo "Skipping Discord ingest test because the DISCORD_TOKEN env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
discord \
|
||||
--num-processes "$max_processes" \
|
||||
--metadata-exclude coordinates,file_directory,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--channels 1099442333440802930,1099601456321003600 \
|
||||
--token "$DISCORD_TOKEN" \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=dropbox
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$DROPBOX_APP_KEY" ] || [ -z "$DROPBOX_APP_SECRET" ] || [ -z "$DROPBOX_REFRESH_TOKEN" ]; then
|
||||
echo "Skipping Dropbox ingest test because one or more of these env vars is not set:"
|
||||
echo "DROPBOX_APP_KEY, DROPBOX_APP_SECRET, DROPBOX_REFRESH_TOKEN"
|
||||
exit 8
|
||||
fi
|
||||
|
||||
# Get a new access token from Dropbox
|
||||
DROPBOX_RESPONSE=$(curl https://api.dropbox.com/oauth2/token -d refresh_token="$DROPBOX_REFRESH_TOKEN" -d grant_type=refresh_token -d client_id="$DROPBOX_APP_KEY" -d client_secret="$DROPBOX_APP_SECRET")
|
||||
DROPBOX_ACCESS_TOKEN=$(jq -r '.access_token' <<<"$DROPBOX_RESPONSE")
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
dropbox \
|
||||
--num-processes "$max_processes" \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--token "$DROPBOX_ACCESS_TOKEN" \
|
||||
--recursive \
|
||||
--remote-url "dropbox://test-input/" \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
echo "SCRIPT_DIR: $SCRIPT_DIR"
|
||||
OUTPUT_FOLDER_NAME=elasticsearch
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
# shellcheck disable=SC1091
|
||||
source scripts/elasticsearch-test-helpers/common/es-dest-ingest-test-creds.env
|
||||
|
||||
function cleanup() {
|
||||
# Kill the container so the script can be repeatedly run using the same ports
|
||||
echo "Stopping Elasticsearch Docker container"
|
||||
docker compose -f scripts/elasticsearch-test-helpers/common/docker-compose.yaml down --remove-orphans -v
|
||||
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
scripts/elasticsearch-test-helpers/source_connector/create-fill-and-check-es.sh
|
||||
wait
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
elasticsearch \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude filename,file_directory,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--index-name movies \
|
||||
--hosts http://localhost:9200 \
|
||||
--username "$ELASTIC_USER" \
|
||||
--password "$ELASTIC_PASSWORD" \
|
||||
--fields 'ethnicity,director,plot' \
|
||||
--work-dir "$WORK_DIR" \
|
||||
--batch-size 2 \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=gcs
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$OUTPUT_ROOT/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
# shellcheck disable=SC2317
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$GCP_INGEST_SERVICE_KEY" ]; then
|
||||
echo "Skipping Google Drive ingest test because the GCP_INGEST_SERVICE_KEY env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
# Create temporary service key file
|
||||
GCP_INGEST_SERVICE_KEY_FILE=$(mktemp)
|
||||
echo "$GCP_INGEST_SERVICE_KEY" >"$GCP_INGEST_SERVICE_KEY_FILE"
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
gcs \
|
||||
--num-processes "$max_processes" \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--service-account-key "$GCP_INGEST_SERVICE_KEY_FILE" \
|
||||
--recursive \
|
||||
--remote-url gs://utic-test-ingest-fixtures/ \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=github
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$OUTPUT_ROOT/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
GH_READ_ONLY_ACCESS_TOKEN=${GH_READ_ONLY_ACCESS_TOKEN:-none}
|
||||
|
||||
ACCESS_TOKEN_FLAGS=""
|
||||
# to update test fixtures, "export OVERWRITE_FIXTURES=true" and rerun this script
|
||||
if [[ "$GH_READ_ONLY_ACCESS_TOKEN" != "none" ]]; then
|
||||
ACCESS_TOKEN_FLAGS="--access-token $GH_READ_ONLY_ACCESS_TOKEN"
|
||||
elif [[ "$CI" == "true" ]]; then
|
||||
echo "Warning: GH_READ_ONLY_ACCESS_TOKEN is not defined in the CI environment."
|
||||
echo "This can lead to intermittent failures in test-ingest-github.sh, as non-auth'ed"
|
||||
echo "requests are severely rate limited by GitHub."
|
||||
echo
|
||||
fi
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
#shellcheck disable=SC2086
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
github \
|
||||
--num-processes "$max_processes" \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--strategy hi_res \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--url dcneiner/Downloadify \
|
||||
--file-glob '*.html,*.txt' \
|
||||
--work-dir "$WORK_DIR" \
|
||||
$ACCESS_TOKEN_FLAGS \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=gitlab
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$OUTPUT_ROOT/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
gitlab \
|
||||
--num-processes "$max_processes" \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_processed,metadata.last_modified,metadata.parent_id,metadata.category_depth \
|
||||
--strategy hi_res \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--git-branch 'v0.0.7' \
|
||||
--git-file-glob '*.md,*.txt' \
|
||||
--url https://gitlab.com/gitlab-com/content-sites/docsy-gitlab \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-num-files-output.sh 2 $OUTPUT_FOLDER_NAME
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# shellcheck disable=SC2329 # Functions are invoked indirectly
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=google-drive
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$OUTPUT_ROOT/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
# shellcheck disable=SC2317
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$GCP_INGEST_SERVICE_KEY" ]; then
|
||||
echo "Skipping Google Drive ingest test because the GCP_INGEST_SERVICE_KEY env var is not set."
|
||||
echo "The Google Drive test content can be found at https://drive.google.com/drive/folders/1OQZ66OHBE30rNsNa7dweGLfRmXvkT_jr"
|
||||
exit 8
|
||||
fi
|
||||
|
||||
# Create temporary service key file
|
||||
GCP_INGEST_SERVICE_KEY_FILE=$(mktemp)
|
||||
echo "$GCP_INGEST_SERVICE_KEY" >"$GCP_INGEST_SERVICE_KEY_FILE"
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
google-drive \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth,metadata.data_source.version \
|
||||
--num-processes "$max_processes" \
|
||||
--strategy hi_res \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--drive-id 1OQZ66OHBE30rNsNa7dweGLfRmXvkT_jr \
|
||||
--service-account-key-path "$GCP_INGEST_SERVICE_KEY_FILE" \
|
||||
--recursive \
|
||||
--extensions "pdf,docx" \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
EXIT_CODE=$?
|
||||
set -e
|
||||
|
||||
if [ "$EXIT_CODE" -ne 0 ]; then
|
||||
echo "The last script run exited with a non-zero exit code: $EXIT_CODE."
|
||||
# Handle the error or exit
|
||||
fi
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
|
||||
exit $EXIT_CODE
|
||||
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=hubspot
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$HUBSPOT_API_TOKEN" ]; then
|
||||
echo "Skipping HubSpot ingest test because the HUBSPOT_API_TOKEN env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
# Required arguments:
|
||||
# --api-token
|
||||
# --> HubSpot client API token. Either from a private app or a valid OAuth2 token
|
||||
# Check https://developers.hubspot.com/docs/api/private-apps
|
||||
|
||||
# Optional arguments:
|
||||
# --object HubSpot object (i.e ticket) to process.
|
||||
# Can be used multiple times to specify multiple objects.
|
||||
# --custom-properties Custom property to process information from. Comma separated list.
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
hubspot \
|
||||
--metadata-exclude file_directory,metadata.data_source.date_processed,metadata.last_modified,metadata.date_created,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--api-token "$HUBSPOT_API_TOKEN" \
|
||||
--object-types "calls,communications,emails,notes,products,tickets" \
|
||||
--custom-properties '{"products":["my_custom_property"],"tickets":["another_custom_property"]}' \
|
||||
--work-dir "$WORK_DIR" \
|
||||
--preserve-downloads \
|
||||
--verbose \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+72
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Description: This test checks if all the processed content is the same as the expected outputs
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
|
||||
OUTPUT_FOLDER_NAME=jira-diff
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$OUTPUT_ROOT/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$JIRA_INGEST_USER_EMAIL" ] || [ -z "$JIRA_INGEST_API_TOKEN" ]; then
|
||||
echo "Skipping Jira ingest test because the JIRA_INGEST_USER_EMAIL or JIRA_INGEST_API_TOKEN env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
# Required arguments:
|
||||
# --url
|
||||
# --> Atlassian (Jira) domain URL
|
||||
# --api-token
|
||||
# --> Api token to authenticate into Atlassian (Jira).
|
||||
# Check https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/ for more info.
|
||||
# --user-email
|
||||
# --> User email for the domain, such as xyz@unstructured.io
|
||||
|
||||
# Optional arguments:
|
||||
# --list-of-projects
|
||||
# --> Comma separated project ids or keys
|
||||
# --list-of-boards
|
||||
# --> Comma separated board ids or keys
|
||||
# --list-of-issues
|
||||
# --> Comma separated issue ids or keys
|
||||
|
||||
# Note: When any of the optional arguments are provided, connector will ingest only those components, and nothing else.
|
||||
# When none of the optional arguments are provided, all issues in all projects will be ingested.
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
jira \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude filename,file_directory,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--url https://unstructured-jira-connector-test.atlassian.net \
|
||||
--user-email "$JIRA_INGEST_USER_EMAIL" \
|
||||
--api-token "$JIRA_INGEST_API_TOKEN" \
|
||||
--projects "JCTP3" \
|
||||
--boards "1" \
|
||||
--issues "JCTP2-4,JCTP2-7,JCTP2-8,10012,JCTP2-11" \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+90
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# shellcheck disable=SC2329 # Functions are invoked indirectly
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=kafka
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$OUTPUT_ROOT/download/$OUTPUT_FOLDER_NAME
|
||||
|
||||
CI=${CI:-"false"}
|
||||
|
||||
RANDOM_SUFFIX=$((RANDOM % 100000 + 1))
|
||||
LC_ALL=C
|
||||
#DO not change this name, it needs to match expected output file name in ../expected-structured-output/kafka/
|
||||
KAFKA_TOPIC="fake-topic"
|
||||
KAFKA_TOPIC=${KAFKA_TOPIC:-"ingest-test-$RANDOM_SUFFIX"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
# shellcheck disable=SC2317
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
echo "here"
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
|
||||
echo "Stopping local Kafka instance"
|
||||
docker compose -f scripts/kafka-test-helpers/docker-compose.yml down --remove-orphans -v
|
||||
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
echo "Creating local Kafka instance"
|
||||
# shellcheck source=/dev/null
|
||||
scripts/kafka-test-helpers/create-kafka-instance.sh
|
||||
wait
|
||||
|
||||
echo "Sending test document (pdf)"
|
||||
#Check the number of messages in destination topic
|
||||
#Note we are calling it twice since this will hack our way into the topic being created (default kafka setting)
|
||||
python "$SCRIPT_DIR"/python/test-produce-kafka-message.py up \
|
||||
--input-file "example-docs/pdf/fake-memo.pdf" \
|
||||
--bootstrap-server localhost \
|
||||
--topic "$KAFKA_TOPIC" \
|
||||
--confluent false \
|
||||
--port 29092
|
||||
python "$SCRIPT_DIR"/python/test-produce-kafka-message.py up \
|
||||
--input-file "example-docs/pdf/fake-memo.pdf" \
|
||||
--bootstrap-server localhost \
|
||||
--topic "$KAFKA_TOPIC" \
|
||||
--confluent false \
|
||||
--port 29092
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
kafka \
|
||||
--bootstrap-server localhost \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--topic "$KAFKA_TOPIC" \
|
||||
--num-messages-to-consume 1 \
|
||||
--port 29092 \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--work-dir "$WORK_DIR" \
|
||||
--confluent false \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
EXIT_CODE=$?
|
||||
set -e
|
||||
|
||||
if [ "$EXIT_CODE" -ne 0 ]; then
|
||||
echo "The last script run exited with a non-zero exit code: $EXIT_CODE."
|
||||
# Handle the error or exit
|
||||
fi
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
|
||||
exit $EXIT_CODE
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=embed-bedrock
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$AWS_ACCESS_KEY_ID" ] || [ -z "$AWS_SECRET_ACCESS_KEY" ]; then
|
||||
echo "Skipping local bedrock ingest test because AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
local \
|
||||
--num-processes "$max_processes" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_created,metadata.data_source.date_modified,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--verbose \
|
||||
--reprocess \
|
||||
--input-path example-docs/book-war-and-peace-1p.txt \
|
||||
--work-dir "$WORK_DIR" \
|
||||
--embedding-provider "aws-bedrock" \
|
||||
--embedding-aws-access-key-id "$AWS_ACCESS_KEY_ID" \
|
||||
--embedding-aws-secret-access-key "$AWS_SECRET_ACCESS_KEY" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
# Set the paths and directories
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=embed-mixedbreadai
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
MXBAI_API_KEY=${MXBAI_API_KEY:-$MXBAI_API_KEY}
|
||||
|
||||
# Include the cleanup script and define the cleanup function
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
# Run the ingestion script with the specified parameters
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
local \
|
||||
--num-processes "$max_processes" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.record_locator.path,metadata.data_source.date_created,metadata.data_source.date_modified,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--verbose \
|
||||
--reprocess \
|
||||
--input-path example-docs/book-war-and-peace-1p.txt \
|
||||
--work-dir "$WORK_DIR" \
|
||||
--embedding-provider "mixedbread-ai" \
|
||||
--embedding-api-key "$MXBAI_API_KEY" \
|
||||
--embedding-model-name "mixedbread-ai/mxbai-embed-large-v1" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
|
||||
# Check the differences with the expected output
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
|
||||
# Evaluate the ingestion results
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=embed-octoai
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
OCTOAI_API_KEY=${OCTOAI_API_KEY:-$OCTOAI_API_KEY}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$OCTOAI_API_KEY" ]; then
|
||||
echo "Skipping local octoai ingest test because the OCTOAI_API_KEY env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
local \
|
||||
--num-processes "$max_processes" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_created,metadata.data_source.date_modified,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--verbose \
|
||||
--reprocess \
|
||||
--input-path example-docs/book-war-and-peace-1p.txt \
|
||||
--work-dir "$WORK_DIR" \
|
||||
--embedding-provider "octoai" \
|
||||
--embedding-api-key "$OCTOAI_API_KEY" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=embed-vertexai
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
GCP_INGEST_SERVICE_KEY=${GCP_INGEST_SERVICE_KEY:-$GCP_INGEST_SERVICE_KEY}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$GCP_INGEST_SERVICE_KEY" ]; then
|
||||
echo "Skipping local vertexai ingest test because the GCP_INGEST_SERVICE_KEY env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
local \
|
||||
--num-processes "$max_processes" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_created,metadata.data_source.date_modified,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--verbose \
|
||||
--reprocess \
|
||||
--input-path example-docs/book-war-and-peace-1p.txt \
|
||||
--work-dir "$WORK_DIR" \
|
||||
--embedding-provider "vertexai" \
|
||||
--embedding-api-key "$GCP_INGEST_SERVICE_KEY" \
|
||||
--embedding-model-name "textembedding-gecko@001" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=embed-voyageai
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
VOYAGE_API_KEY=${VOYAGE_API_KEY:-$VOYAGE_API_KEY}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$VOYAGE_API_KEY" ]; then
|
||||
echo "Skipping local voyageai ingest test because the VOYAGE_API_KEY env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
local \
|
||||
--num-processes "$max_processes" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_created,metadata.data_source.date_modified,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--verbose \
|
||||
--reprocess \
|
||||
--input-path example-docs/book-war-and-peace-1p.txt \
|
||||
--work-dir "$WORK_DIR" \
|
||||
--embedding-provider "voyageai" \
|
||||
--embedding-api-key "$VOYAGE_API_KEY" \
|
||||
--embedding-model-name "voyage-3-large" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=embed
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
local \
|
||||
--num-processes "$max_processes" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_created,metadata.data_source.date_modified,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--verbose \
|
||||
--reprocess \
|
||||
--input-path example-docs/book-war-and-peace-1p.txt \
|
||||
--work-dir "$WORK_DIR" \
|
||||
--embedding-provider "huggingface" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=local-failed-partition
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
echo "RUNNING CLEANUP"
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
function check() {
|
||||
# Currently, unstructured doesn't support .gif files for partitioning so only one of the files should
|
||||
# get successfully partitioned. If support for .gif files is ever added, that test file
|
||||
# should be updated to another non-supported filetype
|
||||
files=$(find "$OUTPUT_DIR" -type f)
|
||||
echo "files: $files"
|
||||
|
||||
"$SCRIPT_DIR"/check-num-files-output.sh 1 "$OUTPUT_FOLDER_NAME"
|
||||
|
||||
filename=$(basename "$files")
|
||||
expected_file="small.txt.json"
|
||||
if [ "$filename" != "$expected_file" ]; then
|
||||
echo "The only partitioned file that should exist is $expected_file, instead found $filename"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
local \
|
||||
--num-processes "$max_processes" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--strategy fast \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--input-path "$SCRIPT_DIR"/failed-partition-docs \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
check
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# shellcheck disable=SC2329 # Functions are invoked indirectly
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=local-single-file-basic-chunking
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
# -- use absolute path of input file to verify passing an absolute path --
|
||||
ABS_INPUT_PATH="$SCRIPT_DIR/../example-docs/handbook-1p.docx"
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
# shellcheck disable=SC2317
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
local \
|
||||
--chunking-strategy basic \
|
||||
--chunk-overlap 20 \
|
||||
--chunk-max-characters 150 \
|
||||
--input-path "$ABS_INPUT_PATH" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_created,metadata.data_source.date_modified,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
EXIT_CODE=$?
|
||||
set -e
|
||||
|
||||
if [ "$EXIT_CODE" -ne 0 ]; then
|
||||
echo "The last script run exited with a non-zero exit code: $EXIT_CODE."
|
||||
# Handle the error or exit
|
||||
fi
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
|
||||
exit $EXIT_CODE
|
||||
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ------------------------------------------------------------------------------------------------
|
||||
# This test exercises the `--chunk-no-include-orig-elements` option which turns off inclusion of
|
||||
# `.metadata.orig_elements` in chunks. It also exercises the `--chunk-no-multipage-sections`
|
||||
# option which otherwise has no other coverage.
|
||||
# ------------------------------------------------------------------------------------------------
|
||||
|
||||
# shellcheck disable=SC2329 # Functions are invoked indirectly
|
||||
|
||||
set -e
|
||||
|
||||
# -- Test Parameters: These vary by test file, others are common computed values --
|
||||
TEST_ROOT_NAME=local-single-file-chunk-no-orig-elements
|
||||
EXAMPLE_DOC=multi-column-2p.pdf
|
||||
|
||||
# -- computed parameters, common across similar tests --
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=$TEST_ROOT_NAME
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
# -- use absolute path of input file to verify passing an absolute path --
|
||||
ABS_INPUT_PATH="$SCRIPT_DIR/../example-docs/pdf/$EXAMPLE_DOC"
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
# shellcheck disable=SC2317
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
local \
|
||||
--chunking-strategy by_title \
|
||||
--no-chunk-include-orig-elements \
|
||||
--chunk-max-characters 2000 \
|
||||
--no-chunk-multipage-sections \
|
||||
--input-path "$ABS_INPUT_PATH" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_created,metadata.data_source.date_modified,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
EXIT_CODE=$?
|
||||
set -e
|
||||
|
||||
if [ "$EXIT_CODE" -ne 0 ]; then
|
||||
echo "The last script run exited with a non-zero exit code: $EXIT_CODE."
|
||||
# Handle the error or exit
|
||||
fi
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
|
||||
exit $EXIT_CODE
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# shellcheck disable=SC2329 # Functions are invoked indirectly
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=local-single-file-with-encoding
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
# shellcheck disable=SC2317
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
local \
|
||||
--num-processes "$max_processes" \
|
||||
--metadata-exclude filename,file_directory,metadata.data_source.date_created,metadata.data_source.date_modified,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--encoding cp1252 \
|
||||
--verbose \
|
||||
--reprocess \
|
||||
--input-path example-docs/fake-html-cp1252.html \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
EXIT_CODE=$?
|
||||
set -e
|
||||
|
||||
if [ "$EXIT_CODE" -ne 0 ]; then
|
||||
echo "The last script run exited with a non-zero exit code: $EXIT_CODE."
|
||||
# Handle the error or exit
|
||||
fi
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
|
||||
exit $EXIT_CODE
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# shellcheck disable=SC2329 # Functions are invoked indirectly
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=local-single-file-with-pdf-infer-table-structure
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
# shellcheck disable=SC2317
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
local \
|
||||
--num-processes "$max_processes" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_created,metadata.data_source.date_modified,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--skip-infer-table-types "xls,xlsx" \
|
||||
--strategy hi_res \
|
||||
--verbose \
|
||||
--reprocess \
|
||||
--input-path "$SCRIPT_DIR"/example-docs/ \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
EXIT_CODE=$?
|
||||
set -e
|
||||
|
||||
if [ "$EXIT_CODE" -ne 0 ]; then
|
||||
echo "The last script run exited with a non-zero exit code: $EXIT_CODE."
|
||||
# Handle the error or exit
|
||||
fi
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
|
||||
exit $EXIT_CODE
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# shellcheck disable=SC2329 # Functions are invoked indirectly
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=local-single-file
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
# assigning an absolute path to the input file so that we explicitly test passing an absolute path
|
||||
ABS_INPUT_PATH="$SCRIPT_DIR/../example-docs/language-docs/UDHR_first_article_all.txt"
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
# shellcheck disable=SC2317
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
local \
|
||||
--num-processes "$max_processes" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_created,metadata.data_source.date_modified,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--additional-partition-args '{"strategy":"ocr_only", "languages":["ind", "est"]}' \
|
||||
--verbose \
|
||||
--reprocess \
|
||||
--input-path "$ABS_INPUT_PATH" \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
EXIT_CODE=$?
|
||||
set -e
|
||||
|
||||
if [ "$EXIT_CODE" -ne 0 ]; then
|
||||
echo "The last script run exited with a non-zero exit code: $EXIT_CODE."
|
||||
# Handle the error or exit
|
||||
fi
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
|
||||
exit $EXIT_CODE
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=local
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
local \
|
||||
--num-processes "$max_processes" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--strategy hi_res \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--file-glob "*.html" \
|
||||
--input-path example-docs \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-num-files-output.sh 15 $OUTPUT_FOLDER_NAME
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
echo "SCRIPT_DIR: $SCRIPT_DIR"
|
||||
OUTPUT_FOLDER_NAME=mongodb
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
SOURCE_MONGO_COLLECTION="sample-mongodb-data"
|
||||
CI=${CI:-"false"}
|
||||
|
||||
if [ -z "$MONGODB_URI" ] && [ -z "$MONGODB_DATABASE_NAME" ]; then
|
||||
echo "Skipping MongoDB source ingest test because the MONGODB_URI and MONGODB_DATABASE_NAME env var are not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
# NOTE(robinson) - per pymongo docs, pymongo ships with its own version of the bson library,
|
||||
# which is incompatible with the bson installed from pypi. bson is installed as part of the
|
||||
# astradb dependencies.
|
||||
# ref: https://pymongo.readthedocs.io/en/stable/installation.html
|
||||
uv pip uninstall bson pymongo 2>/dev/null || true
|
||||
uv pip install "unstructured-ingest[mongodb]"
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
mongodb \
|
||||
--metadata-exclude file_directory,metadata.data_source.date_processed,metadata.last_modified,metadata.date_created,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--uri "$MONGODB_URI" \
|
||||
--database "$MONGODB_DATABASE_NAME" \
|
||||
--collection "$SOURCE_MONGO_COLLECTION" \
|
||||
--work-dir "$WORK_DIR" \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--batch-size 2 \
|
||||
--verbose \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=notion
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$NOTION_API_KEY" ]; then
|
||||
echo "Skipping Notion ingest test because the NOTION_API_KEY env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
notion \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.last_modified,metadata.data_source.date_processed,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--notion-api-key "$NOTION_API_KEY" \
|
||||
--database-ids "122b2c22996b435b9de2ee0e9d2b04bc" \
|
||||
--num-processes "$max_processes" \
|
||||
--recursive \
|
||||
--verbose \
|
||||
--work-dir "$WORK_DIR" \
|
||||
--max-retry-time 30 \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=onedrive
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$MS_CLIENT_ID" ] || [ -z "$MS_CLIENT_CRED" ] || [ -z "$MS_USER_PNAME" ]; then
|
||||
echo "Skipping OneDrive ingest test because the MS_CLIENT_ID, MS_CLIENT_CRED, MS_USER_PNAME env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
onedrive \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude file_directory,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--strategy hi_res \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--client-cred "$MS_CLIENT_CRED" \
|
||||
--client-id "$MS_CLIENT_ID" \
|
||||
--tenant "$MS_TENANT_ID" \
|
||||
--user-pname "$MS_USER_PNAME" \
|
||||
--path '/utic-test-ingest-fixtures' \
|
||||
--recursive \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
echo "SCRIPT_DIR: $SCRIPT_DIR"
|
||||
OUTPUT_FOLDER_NAME=opensearch
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
|
||||
function cleanup() {
|
||||
# Kill the container so the script can be repeatedly run using the same ports
|
||||
echo "Stopping OpenSearch Docker container"
|
||||
docker compose -f scripts/opensearch-test-helpers/common/docker-compose.yaml down --remove-orphans -v
|
||||
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
scripts/opensearch-test-helpers/source_connector/create-and-check-opensearch.sh
|
||||
wait
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
opensearch \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude filename,file_directory,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--index-name movies \
|
||||
--hosts http://localhost:9247 \
|
||||
--username admin \
|
||||
--password admin \
|
||||
--use-ssl \
|
||||
--fields 'ethnicity,director,plot' \
|
||||
--work-dir "$WORK_DIR" \
|
||||
--batch-size 2 \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=outlook
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$MS_CLIENT_ID" ] || [ -z "$MS_CLIENT_CRED" ] || [ -z "$MS_TENANT_ID" ] || [ -z "$MS_USER_EMAIL" ]; then
|
||||
echo "Skipping Outlook ingest test because the MS_CLIENT_ID or MS_CLIENT_CRED or MS_TENANT_ID or MS_USER_EMAIL env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
outlook \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude file_directory,metadata.data_source.date_processed,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--client-cred "$MS_CLIENT_CRED" \
|
||||
--client-id "$MS_CLIENT_ID" \
|
||||
--tenant "$MS_TENANT_ID" \
|
||||
--user-email "$MS_USER_EMAIL" \
|
||||
--outlook-folders IntegrationTest \
|
||||
--recursive \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
# A local connector to process pre-downloaded PDFs under `/download` dir with --fast startegy
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=pdf-fast-reprocess
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
INPUT_PATH=$SCRIPT_DIR/download
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$INPUT_PATH"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
echo "REPROCESS INPUT PATH"
|
||||
ls "$INPUT_PATH"
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
local \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_created,metadata.data_source.date_modified,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--strategy fast \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--file-glob "*.pdf" \
|
||||
--input-path "$INPUT_PATH" \
|
||||
--recursive \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
# Flatten outputs so paths match fixtures. New behavior for downloads in unstructured-ingest is to create a nested directory structure.
|
||||
mkdir -p "$OUTPUT_DIR/azure"
|
||||
find "$OUTPUT_DIR/azure" -type f -name '*.json' -path '*/unstructured_*/*' -print0 | while IFS= read -r -d '' f; do
|
||||
mv "$f" "$OUTPUT_DIR/azure/$(basename "$f")"
|
||||
done
|
||||
find "$OUTPUT_DIR/azure" -type d -name 'unstructured_*' -exec rm -rf {} +
|
||||
|
||||
# Normalize record_locator.path to drop unstructured_* in the download path
|
||||
python3 - "$OUTPUT_DIR/azure" <<'PY'
|
||||
import re, sys, pathlib
|
||||
root = pathlib.Path(sys.argv[1])
|
||||
for p in root.rglob('*.json'):
|
||||
s = p.read_text()
|
||||
s2 = re.sub(r'(/download/azure)/unstructured_[^/]+/', r'\1/', s)
|
||||
if s2 != s:
|
||||
p.write_text(s2)
|
||||
PY
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=s3-compression
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
s3 \
|
||||
--num-processes "$max_processes" \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--strategy fast \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--remote-url s3://utic-dev-tech-fixtures/small-pdf-set-w-compression/ \
|
||||
--anonymous \
|
||||
--work-dir "$WORK_DIR" \
|
||||
--uncompress \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-num-files-output.sh 12 $OUTPUT_FOLDER_NAME
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# shellcheck disable=SC2329 # Functions are invoked indirectly
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=s3-minio
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
secret_key=minioadmin
|
||||
access_key=minioadmin
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
# shellcheck disable=SC2317
|
||||
function cleanup() {
|
||||
# Kill the container so the script can be repeatedly run using the same ports
|
||||
echo "Stopping Minio Docker container"
|
||||
docker compose -f scripts/minio-test-helpers/docker-compose.yaml down --remove-orphans -v
|
||||
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
scripts/minio-test-helpers/create-and-check-minio.sh
|
||||
wait
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
s3 \
|
||||
--num-processes "$max_processes" \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_processed,metadata.data_source.date_modified,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth,metadata.data_source.date_created \
|
||||
--strategy hi_res \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--remote-url s3://utic-dev-tech-fixtures/ \
|
||||
--endpoint-url http://localhost:9000 \
|
||||
--key "$access_key" \
|
||||
--secret "$secret_key" \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
EXIT_CODE=$?
|
||||
set -e
|
||||
|
||||
if [ "$EXIT_CODE" -ne 0 ]; then
|
||||
echo "The last script run exited with a non-zero exit code: $EXIT_CODE."
|
||||
# Handle the error or exit
|
||||
fi
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
|
||||
exit $EXIT_CODE
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# shellcheck disable=SC2329 # Functions are invoked indirectly
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=s3
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
# shellcheck disable=SC2317
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
"$SCRIPT_DIR"/check-num-files-expected-output.sh 3 $OUTPUT_FOLDER_NAME 20k
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
s3 \
|
||||
--num-processes "$max_processes" \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--strategy hi_res \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--remote-url s3://utic-dev-tech-fixtures/small-pdf-set/ \
|
||||
--anonymous \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
EXIT_CODE=$?
|
||||
set -e
|
||||
|
||||
if [ "$EXIT_CODE" -ne 0 ]; then
|
||||
echo "The last script run exited with a non-zero exit code: $EXIT_CODE."
|
||||
# Handle the error or exit
|
||||
fi
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
|
||||
exit $EXIT_CODE
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Set either SALESFORCE_PRIVATE_KEY (app config json content as string) or
|
||||
# SALESFORCE_PRIVATE_KEY_PATH (path to app config json file) env var
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=salesforce
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$SALESFORCE_USERNAME" ] || [ -z "$SALESFORCE_CONSUMER_KEY" ]; then
|
||||
echo "Skipping Salesforce ingest test because SALESFORCE_USERNAME and SALESFORCE_CONSUMER_KEY env vars not set"
|
||||
exit 8
|
||||
fi
|
||||
|
||||
if [ -z "$SALESFORCE_PRIVATE_KEY" ] && [ -z "$SALESFORCE_PRIVATE_KEY_PATH" ]; then
|
||||
echo "Skipping Salesforce ingest test because neither SALESFORCE_PRIVATE_KEY nor SALESFORCE_PRIVATE_KEY_PATH env vars are set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
if [ -z "$SALESFORCE_PRIVATE_KEY_PATH" ]; then
|
||||
# Create temporary service key file
|
||||
SALESFORCE_PRIVATE_KEY_PATH=$(mktemp)
|
||||
echo "$SALESFORCE_PRIVATE_KEY" >"$SALESFORCE_PRIVATE_KEY_PATH"
|
||||
fi
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
salesforce \
|
||||
--categories "EmailMessage,Campaign" \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--username "$SALESFORCE_USERNAME" \
|
||||
--consumer-key "$SALESFORCE_CONSUMER_KEY" \
|
||||
--private-key-path "$SALESFORCE_PRIVATE_KEY_PATH" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=sftp
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$OUTPUT_ROOT/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
# shellcheck disable=SC2317
|
||||
function cleanup() {
|
||||
# Kill the container so the script can be repeatedly run using the same ports
|
||||
echo "Stopping Sftp Docker container"
|
||||
docker compose -f scripts/sftp-test-helpers/docker-compose.yaml down --remove-orphans -v
|
||||
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
scripts/sftp-test-helpers/create-and-check-sftp.sh
|
||||
wait
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
sftp \
|
||||
--num-processes "$max_processes" \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude file_directory,metadata.data_source.date_processed,metadata.data_source.filesize_bytes,metadata.data_source.date_created,metadata.data_source.date_modified,metadata.last_modified,metadata.data_source.version \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--recursive \
|
||||
--username foo \
|
||||
--password bar \
|
||||
--remote-url sftp://localhost:47474/upload/ \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Original intent of this test was to diff the permissions metadata. Unfortunately this is unstable.
|
||||
# Since we still want to test the permission login functionality, we will test the permissions metadata when we get there.
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=Sharepoint-with-permissions
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$SHAREPOINT_CLIENT_ID" ] || [ -z "$SHAREPOINT_CRED" ]; then
|
||||
echo "Skipping Sharepoint ingest test because the SHAREPOINT_CLIENT_ID or SHAREPOINT_CRED env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
if [ -z "$SHAREPOINT_PERMISSIONS_APP_ID" ] || [ -z "$SHAREPOINT_PERMISSIONS_APP_CRED" ] || [ -z "$SHAREPOINT_PERMISSIONS_TENANT" ]; then
|
||||
echo "Skipping Sharepoint ingest test because the SHAREPOINT_PERMISSIONS_APP_ID, SHAREPOINT_PERMISSIONS_APP_CRED, or SHAREPOINT_PERMISSIONS_TENANT env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
# excluding metadata.last_modified since this will always update as date processed because the Sharepoint connector creates documents on the fly
|
||||
# excluding metadata.data_source.permissions_data since the api has deprecation warnings. Will want to do a separate test for permissions data
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
sharepoint \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude file_directory,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth,metadata.data_source.permissions_data \
|
||||
--num-processes "$max_processes" \
|
||||
--strategy hi_res \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--client-cred "$SHAREPOINT_CRED" \
|
||||
--client-id "$SHAREPOINT_CLIENT_ID" \
|
||||
--site "$SHAREPOINT_SITE" \
|
||||
--permissions-application-id "$SHAREPOINT_PERMISSIONS_APP_ID" \
|
||||
--permissions-client-cred "$SHAREPOINT_PERMISSIONS_APP_CRED" \
|
||||
--permissions-tenant "$SHAREPOINT_PERMISSIONS_TENANT" \
|
||||
--recursive \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# shellcheck disable=SC2329 # Functions are invoked indirectly
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=Sharepoint
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
# shellcheck disable=SC2317
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$SHAREPOINT_CLIENT_ID" ] || [ -z "$SHAREPOINT_CRED" ]; then
|
||||
echo "Skipping Sharepoint ingest test because the SHAREPOINT_CLIENT_ID or SHAREPOINT_CRED env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
# excluding metadata.last_modified since this will always update as date processed because the Sharepoint connector creates documents on the fly
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
sharepoint \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude file_directory,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--strategy hi_res \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--client-cred "$SHAREPOINT_CRED" \
|
||||
--client-id "$SHAREPOINT_CLIENT_ID" \
|
||||
--site "$SHAREPOINT_SITE" \
|
||||
--recursive \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
set +e
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
EXIT_CODE=$?
|
||||
set -e
|
||||
|
||||
if [ "$EXIT_CODE" -ne 0 ]; then
|
||||
echo "The last script run exited with a non-zero exit code: $EXIT_CODE."
|
||||
# Handle the error or exit
|
||||
fi
|
||||
|
||||
"$SCRIPT_DIR"/evaluation-ingest-cp.sh "$OUTPUT_DIR" "$OUTPUT_FOLDER_NAME"
|
||||
|
||||
exit $EXIT_CODE
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=slack
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -z "$SLACK_TOKEN" ]; then
|
||||
echo "Skipping Slack ingest test because the SLACK_TOKEN env var is not set."
|
||||
exit 8
|
||||
fi
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
slack \
|
||||
--num-processes "$max_processes" \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude coordinates,file_directory,metadata.data_source.date_processed,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--strategy hi_res \
|
||||
--preserve-downloads \
|
||||
--reprocess \
|
||||
--verbose \
|
||||
--channels C07ABKJ83C6 \
|
||||
--token "${SLACK_TOKEN}" \
|
||||
--start-date 2023-04-01 \
|
||||
--end-date 2024-07-01T07:47:00-07:00 \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-diff-expected-output.sh $OUTPUT_FOLDER_NAME
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SRC_PATH=$(dirname "$(realpath "$0")")
|
||||
SCRIPT_DIR=$(dirname "$SRC_PATH")
|
||||
cd "$SCRIPT_DIR"/.. || exit 1
|
||||
OUTPUT_FOLDER_NAME=wikipedia
|
||||
OUTPUT_ROOT=${OUTPUT_ROOT:-$SCRIPT_DIR}
|
||||
OUTPUT_DIR=$OUTPUT_ROOT/structured-output/$OUTPUT_FOLDER_NAME
|
||||
WORK_DIR=$OUTPUT_ROOT/workdir/$OUTPUT_FOLDER_NAME
|
||||
DOWNLOAD_DIR=$SCRIPT_DIR/download/$OUTPUT_FOLDER_NAME
|
||||
max_processes=${MAX_PROCESSES:=$(python3 -c "import os; print(os.cpu_count())")}
|
||||
CI=${CI:-"false"}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR"/cleanup.sh
|
||||
function cleanup() {
|
||||
cleanup_dir "$OUTPUT_DIR"
|
||||
cleanup_dir "$WORK_DIR"
|
||||
if [ "$CI" == "true" ]; then
|
||||
cleanup_dir "$DOWNLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
RUN_SCRIPT=${RUN_SCRIPT:-unstructured-ingest}
|
||||
PYTHONPATH=${PYTHONPATH:-.} "$RUN_SCRIPT" \
|
||||
wikipedia \
|
||||
--download-dir "$DOWNLOAD_DIR" \
|
||||
--metadata-exclude coordinates,filename,file_directory,metadata.last_modified,metadata.detection_class_prob,metadata.parent_id,metadata.category_depth \
|
||||
--num-processes "$max_processes" \
|
||||
--strategy hi_res \
|
||||
--preserve-downloads \
|
||||
--verbose \
|
||||
--page-title "Open Source Software" \
|
||||
--work-dir "$WORK_DIR" \
|
||||
local \
|
||||
--output-dir "$OUTPUT_DIR"
|
||||
|
||||
"$SCRIPT_DIR"/check-num-files-output.sh 3 $OUTPUT_FOLDER_NAME
|
||||
Reference in New Issue
Block a user