mirror of
https://github.com/azaion/detections.git
synced 2026-04-25 23:06:31 +00:00
This commit is contained in:
@@ -6,6 +6,7 @@ RUN apt-get update && apt-get install -y \
|
|||||||
python3 python3-pip python3-dev gcc \
|
python3 python3-pip python3-dev gcc \
|
||||||
libgl1 libglib2.0-0 \
|
libgl1 libglib2.0-0 \
|
||||||
python3-libnvinfer python3-libnvinfer-dev \
|
python3-libnvinfer python3-libnvinfer-dev \
|
||||||
|
python3-pycuda \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -58,10 +58,36 @@ services:
|
|||||||
aliases:
|
aliases:
|
||||||
- detections
|
- detections
|
||||||
|
|
||||||
|
detections-jetson:
|
||||||
|
profiles:
|
||||||
|
- jetson
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: Dockerfile.jetson
|
||||||
|
runtime: nvidia
|
||||||
|
depends_on:
|
||||||
|
- mock-loader
|
||||||
|
- mock-annotations
|
||||||
|
environment:
|
||||||
|
LOADER_URL: http://mock-loader:8080
|
||||||
|
ANNOTATIONS_URL: http://mock-annotations:8081
|
||||||
|
JWT_SECRET: test-secret-e2e-only
|
||||||
|
CLASSES_JSON_PATH: /app/classes.json
|
||||||
|
volumes:
|
||||||
|
- ./fixtures/classes.json:/app/classes.json:ro
|
||||||
|
- ./fixtures:/media:ro
|
||||||
|
- ./logs:/app/Logs
|
||||||
|
shm_size: 512m
|
||||||
|
networks:
|
||||||
|
e2e-net:
|
||||||
|
aliases:
|
||||||
|
- detections
|
||||||
|
|
||||||
e2e-runner:
|
e2e-runner:
|
||||||
profiles:
|
profiles:
|
||||||
- cpu
|
- cpu
|
||||||
- gpu
|
- gpu
|
||||||
|
- jetson
|
||||||
build: .
|
build: .
|
||||||
depends_on:
|
depends_on:
|
||||||
- mock-loader
|
- mock-loader
|
||||||
|
|||||||
+31
-4
@@ -1,7 +1,24 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
COMPOSE="docker compose -f docker-compose.test.yml --profile cpu"
|
PROFILE="${E2E_PROFILE:-cpu}"
|
||||||
|
case "$PROFILE" in
|
||||||
|
cpu)
|
||||||
|
DETECTIONS_SERVICE="detections"
|
||||||
|
;;
|
||||||
|
gpu)
|
||||||
|
DETECTIONS_SERVICE="detections-gpu"
|
||||||
|
;;
|
||||||
|
jetson)
|
||||||
|
DETECTIONS_SERVICE="detections-jetson"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR: unsupported E2E_PROFILE=$PROFILE (expected: cpu, gpu, jetson)"
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
COMPOSE="docker compose -f docker-compose.test.yml --profile $PROFILE"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: $0 <test_path> [pytest_args...]"
|
echo "Usage: $0 <test_path> [pytest_args...]"
|
||||||
@@ -11,27 +28,37 @@ usage() {
|
|||||||
echo " $0 tests/test_video.py::test_ft_p_10_frame_sampling_ac1 # run single test"
|
echo " $0 tests/test_video.py::test_ft_p_10_frame_sampling_ac1 # run single test"
|
||||||
echo " $0 tests/test_video.py -k 'frame_sampling' # run by keyword"
|
echo " $0 tests/test_video.py -k 'frame_sampling' # run by keyword"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "Environment:"
|
||||||
|
echo " E2E_PROFILE=cpu|gpu|jetson compose profile to run (default: cpu)"
|
||||||
|
echo ""
|
||||||
echo "Flags -v -x -s are always included."
|
echo "Flags -v -x -s are always included."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
[[ $# -lt 1 ]] && usage
|
[[ $# -lt 1 ]] && usage
|
||||||
|
|
||||||
$COMPOSE up -d --build detections
|
$COMPOSE up -d --build "$DETECTIONS_SERVICE"
|
||||||
echo "--- Waiting for detections service to become healthy..."
|
echo "--- Waiting for detections service to become healthy..."
|
||||||
for i in $(seq 1 60); do
|
for i in $(seq 1 60); do
|
||||||
if $COMPOSE exec -T detections python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/health')" 2>/dev/null; then
|
if $COMPOSE exec -T "$DETECTIONS_SERVICE" python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/health')" 2>/dev/null; then
|
||||||
echo "--- Detections service is healthy"
|
echo "--- Detections service is healthy"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
if [[ "$i" == "60" ]]; then
|
||||||
|
echo "ERROR: detections service did not become healthy"
|
||||||
|
$COMPOSE logs "$DETECTIONS_SERVICE" --tail 100
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "--- Running: pytest $* -v -x -s --csv=/results/report.csv"
|
echo "--- Running: pytest $* -v -x -s --csv=/results/report.csv"
|
||||||
|
set +e
|
||||||
$COMPOSE run --rm --no-deps e2e-runner pytest "$@" -v -x -s --csv=/results/report.csv
|
$COMPOSE run --rm --no-deps e2e-runner pytest "$@" -v -x -s --csv=/results/report.csv
|
||||||
EXIT_CODE=$?
|
EXIT_CODE=$?
|
||||||
|
set -e
|
||||||
|
|
||||||
echo "--- Test finished with exit code $EXIT_CODE"
|
echo "--- Test finished with exit code $EXIT_CODE"
|
||||||
echo "--- Detections logs (last 100 lines):"
|
echo "--- Detections logs (last 100 lines):"
|
||||||
$COMPOSE logs detections --tail 100
|
$COMPOSE logs "$DETECTIONS_SERVICE" --tail 100
|
||||||
exit $EXIT_CODE
|
exit $EXIT_CODE
|
||||||
|
|||||||
@@ -11,4 +11,3 @@ requests==2.32.4
|
|||||||
loguru==0.7.3
|
loguru==0.7.3
|
||||||
av==14.2.0
|
av==14.2.0
|
||||||
xxhash==3.5.0
|
xxhash==3.5.0
|
||||||
pycuda
|
|
||||||
|
|||||||
Reference in New Issue
Block a user