LocationBasedServices/smartguide/pipeline/head There was a failure building this commit
41 lines
2.1 KiB
Bash
Executable File
41 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run load_graph.py inside the inse-service image, which already has every backend
|
|
# dependency (torch/sentence-transformers included), and talk to FalkorDB on the host.
|
|
#
|
|
# scripts/falkordb/run.sh # 2 researchers per default organization
|
|
# scripts/falkordb/run.sh --reset --organization Duisburg --per-org 3
|
|
# scripts/falkordb/run.sh --author-id A5040796987 --author-id A5119657791
|
|
# scripts/falkordb/run.sh bulk --graph ude --reset # whole-university graph (bulk_load.py)
|
|
#
|
|
# Env: INSE_IMAGE (default inse-service:1.0.0, built by ./gradlew :service:createImage),
|
|
# FALKORDB_HOST (default host.docker.internal), FALKORDB_PORT, FALKORDB_PASSWORD, FALKORDB_GRAPH.
|
|
set -euo pipefail
|
|
|
|
SERVICE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
# First argument "bulk" selects the whole-university loader (bulk_load.py); otherwise load_graph.py runs.
|
|
SCRIPT="load_graph.py"
|
|
if [ "${1:-}" = "bulk" ]; then SCRIPT="bulk_load.py"; shift; fi
|
|
IMAGE="${INSE_IMAGE:-inse-service:1.0.0}"
|
|
TTY_FLAGS=""
|
|
if [ -t 0 ] && [ -t 1 ]; then TTY_FLAGS="-it"; fi
|
|
# Match the image's platform (the Gradle build targets amd64), avoiding Docker's mismatch warning on arm64 hosts.
|
|
PLATFORM="$(docker image inspect --format '{{.Os}}/{{.Architecture}}' "$IMAGE" 2>/dev/null || true)"
|
|
PLATFORM_FLAGS=""
|
|
if [ -n "$PLATFORM" ]; then PLATFORM_FLAGS="--platform $PLATFORM"; fi
|
|
|
|
exec docker run --rm $TTY_FLAGS $PLATFORM_FLAGS \
|
|
-v "$SERVICE_DIR/src/main:/home" \
|
|
-v "$SERVICE_DIR/src/data:/data" \
|
|
-v "$SERVICE_DIR/scripts:/scripts" \
|
|
-w /home \
|
|
--add-host host.docker.internal:host-gateway \
|
|
-e FALKORDB_HOST="${FALKORDB_HOST:-host.docker.internal}" \
|
|
-e FALKORDB_PORT="${FALKORDB_PORT:-6379}" \
|
|
-e FALKORDB_PASSWORD="${FALKORDB_PASSWORD:-}" \
|
|
-e FALKORDB_GRAPH="${FALKORDB_GRAPH:-inse}" \
|
|
-e PRINT_ES_QUERIES=false -e PRINT_ES_TIMINGS=false \
|
|
-e HF_HUB_DISABLE_PROGRESS_BARS=1 -e TQDM_DISABLE=1 \
|
|
--entrypoint sh "$IMAGE" -c \
|
|
'pip install -q --root-user-action=ignore --disable-pip-version-check -r /scripts/falkordb/requirements.txt && exec python "/scripts/falkordb/$0" "$@"' \
|
|
"$SCRIPT" "$@"
|