Skip to content

Commit ecf3338

Browse files
authored
refactor searchqna ci test (#437)
Signed-off-by: chensuyue <[email protected]>
1 parent b7975e7 commit ecf3338

File tree

7 files changed

+49
-48
lines changed

7 files changed

+49
-48
lines changed

SearchQnA/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,22 @@ bash ./docker/set_env.sh
6363

6464
## Deploy SearchQnA on Gaudi
6565

66-
If your version of `Habana Driver` < 1.16.0 (check with `hl-smi`), run the following command directly to start SearchQnA services. Please find corresponding [docker_compose.yaml](./docker/gaudi/docker_compose.yaml).
66+
If your version of `Habana Driver` < 1.16.0 (check with `hl-smi`), run the following command directly to start SearchQnA services. Please find corresponding [compose.yaml](./docker/gaudi/compose.yaml).
6767

6868
```bash
6969
cd GenAIExamples/SearchQnA/docker/gaudi/
70-
docker compose -f docker_compose.yaml up -d
70+
docker compose up -d
7171
```
7272

7373
If your version of `Habana Driver` >= 1.16.0, refer to the [Gaudi Guide](./docker/gaudi/README.md) to build docker images from source.
7474

7575
## Deploy SearchQnA on Xeon
7676

77-
Please find corresponding [docker_compose.yaml](./docker/xeon/docker_compose.yaml).
77+
Please find corresponding [compose.yaml](./docker/xeon/compose.yaml).
7878

7979
```bash
8080
cd GenAIExamples/SearchQnA/docker/xeon/
81-
docker compose -f docker_compose.yaml up -d
81+
docker compose up -d
8282
```
8383

8484
Refer to the [Xeon Guide](./docker/xeon/README.md) for more instructions on building docker images from source.
@@ -116,6 +116,6 @@ curl http://${host_ip}:3001/embed \
116116
-H 'Content-Type: application/json'
117117
```
118118

119-
2. (Docker only) If all microservices work well, please check the port ${host_ip}:3008, the port may be allocated by other users, you can modify the `docker_compose.yaml`.
119+
2. (Docker only) If all microservices work well, please check the port ${host_ip}:3008, the port may be allocated by other users, you can modify the `compose.yaml`.
120120

121-
3. (Docker only) If you get errors like "The container name is in use", please change container name in `docker_compose.yaml`.
121+
3. (Docker only) If you get errors like "The container name is in use", please change container name in `compose.yaml`.

SearchQnA/docker/gaudi/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export LLM_SERVICE_PORT=3007
109109

110110
```bash
111111
cd GenAIExamples/SearchQnA/docker/gaudi/
112-
docker compose -f docker_compose.yaml up -d
112+
docker compose up -d
113113
```
114114

115115
## 🚀 Test MicroServices

SearchQnA/docker/xeon/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export LLM_SERVICE_PORT=3007
8888

8989
```bash
9090
cd GenAIExamples/SearchQnA/docker/xeon/
91-
docker compose -f docker_compose.yaml up -d
91+
docker compose up -d
9292
```
9393

9494
## 🚀 Test MicroServices

SearchQnA/tests/test_searchqna_on_gaudi.sh

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ function build_docker_images() {
2020
docker build --no-cache -t opea/reranking-tei:latest -f comps/reranks/tei/docker/Dockerfile .
2121
docker build --no-cache -t opea/llm-tgi:latest -f comps/llms/text-generation/tgi/Dockerfile .
2222

23-
cd ..
24-
git clone https://github.com/huggingface/tei-gaudi
25-
cd tei-gaudi/
26-
docker build --no-cache -f Dockerfile-hpu -t opea/tei-gaudi:latest .
23+
# cd ..
24+
# git clone https://github.com/huggingface/tei-gaudi
25+
# cd tei-gaudi/
26+
# docker build --no-cache -f Dockerfile-hpu -t opea/tei-gaudi:latest .
2727

2828
docker pull ghcr.io/huggingface/text-embeddings-inference:cpu-1.2
2929
docker pull ghcr.io/huggingface/tgi-gaudi:2.0.1
@@ -37,6 +37,12 @@ function build_docker_images() {
3737
}
3838

3939
function start_services() {
40+
# build tei-gaudi for each test instead of pull from local registry
41+
cd $WORKPATH
42+
git clone https://github.com/huggingface/tei-gaudi
43+
cd tei-gaudi/
44+
docker build --no-cache -f Dockerfile-hpu -t opea/tei-gaudi:latest .
45+
4046
cd $WORKPATH/docker/gaudi
4147
export GOOGLE_CSE_ID=$GOOGLE_CSE_ID
4248
export GOOGLE_API_KEY=$GOOGLE_API_KEY
@@ -63,17 +69,23 @@ function start_services() {
6369

6470
# sed -i "s/backend_address/$ip_address/g" $WORKPATH/docker/ui/svelte/.env
6571

66-
# Replace the container name with a test-specific name
67-
# echo "using image repository $IMAGE_REPO and image tag $IMAGE_TAG"
68-
# sed -i "s#image: opea/chatqna:latest#image: opea/chatqna:${IMAGE_TAG}#g" docker_compose.yaml
69-
# sed -i "s#image: opea/chatqna-ui:latest#image: opea/chatqna-ui:${IMAGE_TAG}#g" docker_compose.yaml
70-
# sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" docker_compose.yaml
72+
if [[ "$IMAGE_REPO" != "" ]]; then
73+
# Replace the container name with a test-specific name
74+
echo "using image repository $IMAGE_REPO and image tag $IMAGE_TAG"
75+
sed -i "s#image: opea/searchqna:latest#image: opea/searchqna:${IMAGE_TAG}#g" compose.yaml
76+
sed -i "s#image: opea/searchqna-ui:latest#image: opea/searchqna-ui:${IMAGE_TAG}#g" compose.yaml
77+
sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" compose.yaml
78+
sed -i "s#image: ${IMAGE_REPO}opea/tei-gaudi:latest#image: opea/tei-gaudi:latest#g" compose.yaml
79+
echo "cat compose.yaml"
80+
cat compose.yaml
81+
fi
82+
7183
# Start Docker Containers
72-
docker compose -f docker_compose.yaml up -d
84+
docker compose up -d
7385
n=0
7486
until [[ "$n" -ge 500 ]]; do
75-
docker logs tgi-gaudi-server > tgi_service_start.log
76-
if grep -q Connected tgi_service_start.log; then
87+
docker logs tgi-gaudi-server > $LOG_PATH/tgi_service_start.log
88+
if grep -q Connected $LOG_PATH/tgi_service_start.log; then
7789
break
7890
fi
7991
sleep 1s
@@ -126,22 +138,14 @@ function validate_megaservice() {
126138

127139
function stop_docker() {
128140
cd $WORKPATH/docker/gaudi
129-
container_list=$(cat docker_compose.yaml | grep container_name | cut -d':' -f2)
130-
for container_name in $container_list; do
131-
cid=$(docker ps -aq --filter "name=$container_name")
132-
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && sleep 1s; fi
133-
done
141+
docker compose down
134142
}
135143

136144
function main() {
137145

138146
stop_docker
139-
build_docker_images
140-
# begin_time=$(date +%s)
147+
if [[ "$IMAGE_REPO" == "" ]]; then build_docker_images; fi
141148
start_services
142-
# end_time=$(date +%s)
143-
# maximal_duration=$((end_time-begin_time))
144-
# echo "Mega service start duration is "$maximal_duration"s" && sleep 1s
145149

146150
validate_megaservice
147151
# validate_frontend

SearchQnA/tests/test_searchqna_on_xeon.sh

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,22 @@ function start_services() {
5555

5656
# sed -i "s/backend_address/$ip_address/g" $WORKPATH/docker/ui/svelte/.env
5757

58-
# Replace the container name with a test-specific name
59-
# echo "using image repository $IMAGE_REPO and image tag $IMAGE_TAG"
60-
# sed -i "s#image: opea/chatqna:latest#image: opea/chatqna:${IMAGE_TAG}#g" docker_compose.yaml
61-
# sed -i "s#image: opea/chatqna-ui:latest#image: opea/chatqna-ui:${IMAGE_TAG}#g" docker_compose.yaml
62-
# sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" docker_compose.yaml
58+
if [[ "$IMAGE_REPO" != "" ]]; then
59+
# Replace the container name with a test-specific name
60+
echo "using image repository $IMAGE_REPO and image tag $IMAGE_TAG"
61+
sed -i "s#image: opea/searchqna:latest#image: opea/searchqna:${IMAGE_TAG}#g" compose.yaml
62+
sed -i "s#image: opea/searchqna-ui:latest#image: opea/searchqna-ui:${IMAGE_TAG}#g" compose.yaml
63+
sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" compose.yaml
64+
echo "cat compose.yaml"
65+
cat compose.yaml
66+
fi
67+
6368
# Start Docker Containers
64-
docker compose -f docker_compose.yaml up -d
69+
docker compose up -d
6570
n=0
6671
until [[ "$n" -ge 200 ]]; do
67-
docker logs tgi-service > tgi_service_start.log
68-
if grep -q Connected tgi_service_start.log; then
72+
docker logs tgi-service > $LOG_PATH/tgi_service_start.log
73+
if grep -q Connected $LOG_PATH/tgi_service_start.log; then
6974
break
7075
fi
7176
sleep 1s
@@ -116,22 +121,14 @@ function validate_megaservice() {
116121

117122
function stop_docker() {
118123
cd $WORKPATH/docker/xeon
119-
container_list=$(cat docker_compose.yaml | grep container_name | cut -d':' -f2)
120-
for container_name in $container_list; do
121-
cid=$(docker ps -aq --filter "name=$container_name")
122-
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && sleep 1s; fi
123-
done
124+
docker compose down
124125
}
125126

126127
function main() {
127128

128129
stop_docker
129-
build_docker_images
130-
# begin_time=$(date +%s)
130+
if [[ "$IMAGE_REPO" == "" ]]; then build_docker_images; fi
131131
start_services
132-
# end_time=$(date +%s)
133-
# maximal_duration=$((end_time-begin_time))
134-
# echo "Mega service start duration is "$maximal_duration"s" && sleep 1s
135132

136133
validate_megaservice
137134
# validate_frontend

0 commit comments

Comments
 (0)