Skip to content

Commit 04d527d

Browse files
authored
Integrate set_env to ut scripts for CodeTrans. (opea-project#1868)
Signed-off-by: ZePan110 <[email protected]>
1 parent 13c4749 commit 04d527d

File tree

9 files changed

+76
-97
lines changed

9 files changed

+76
-97
lines changed

CodeTrans/docker_compose/amd/gpu/rocm/set_env.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
# which can be used to connect to the server from the Internet. It must be specified in the EXTERNAL_HOST_IP variable.
99
# If the server is used only on the internal network or has a direct external address,
1010
# specify it in HOST_IP and in EXTERNAL_HOST_IP.
11-
export HOST_IP=''
12-
export EXTERNAL_HOST_IP=''
11+
export HOST_IP=${ip_address}
12+
export EXTERNAL_HOST_IP=${ip_address}
1313

1414
### Model ID
1515
export CODETRANS_LLM_MODEL_ID="Qwen/Qwen2.5-Coder-7B-Instruct"
1616

1717
### The port of the TGI service. On this port, the TGI service will accept connections
18-
export CODETRANS_TGI_SERVICE_PORT=18156
18+
export CODETRANS_TGI_SERVICE_PORT=8008
1919

2020
### The endpoint of the TGI service to which requests to this service will be sent (formed from previously set variables)
2121
export CODETRANS_TGI_LLM_ENDPOINT="http://${HOST_IP}:${CODETRANS_TGI_SERVICE_PORT}"
@@ -24,7 +24,7 @@ export CODETRANS_TGI_LLM_ENDPOINT="http://${HOST_IP}:${CODETRANS_TGI_SERVICE_POR
2424
export CODETRANS_HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
2525

2626
### The port of the LLM service. On this port, the LLM service will accept connections
27-
export CODETRANS_LLM_SERVICE_PORT=18157
27+
export CODETRANS_LLM_SERVICE_PORT=9000
2828

2929
### The IP address or domain name of the server for CodeTrans MegaService
3030
export CODETRANS_MEGA_SERVICE_HOST_IP=${HOST_IP}
@@ -36,7 +36,7 @@ export CODETRANS_LLM_SERVICE_HOST_IP=${HOST_IP}
3636
export CODETRANS_FRONTEND_SERVICE_IP=${HOST_IP}
3737

3838
### The port of the frontend service
39-
export CODETRANS_FRONTEND_SERVICE_PORT=18155
39+
export CODETRANS_FRONTEND_SERVICE_PORT=5173
4040

4141
### Name of GenAI service for route requests to application
4242
export CODETRANS_BACKEND_SERVICE_NAME=codetrans
@@ -45,10 +45,10 @@ export CODETRANS_BACKEND_SERVICE_NAME=codetrans
4545
export CODETRANS_BACKEND_SERVICE_IP=${HOST_IP}
4646

4747
### The port of the backend service
48-
export CODETRANS_BACKEND_SERVICE_PORT=18154
48+
export CODETRANS_BACKEND_SERVICE_PORT=7777
4949

5050
### The port of the Nginx reverse proxy for application
51-
export CODETRANS_NGINX_PORT=18153
51+
export CODETRANS_NGINX_PORT=8088
5252

5353
### Endpoint of the backend service
5454
export CODETRANS_BACKEND_SERVICE_URL="http://${EXTERNAL_HOST_IP}:${CODETRANS_BACKEND_SERVICE_PORT}/v1/codetrans"

CodeTrans/docker_compose/amd/gpu/rocm/set_env_vllm.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
# which can be used to connect to the server from the Internet. It must be specified in the EXTERNAL_HOST_IP variable.
99
# If the server is used only on the internal network or has a direct external address,
1010
# specify it in HOST_IP and in EXTERNAL_HOST_IP.
11-
export HOST_IP=''
12-
export EXTERNAL_HOST_IP=''
11+
export HOST_IP=${ip_address}
12+
export EXTERNAL_HOST_IP=${ip_address}
1313

1414
### Model ID
1515
export CODETRANS_LLM_MODEL_ID="Qwen/Qwen2.5-Coder-7B-Instruct"
1616

1717
### The port of the TGI service. On this port, the TGI service will accept connections
18-
export CODETRANS_VLLM_SERVICE_PORT=18156
18+
export CODETRANS_VLLM_SERVICE_PORT=8008
1919

2020
### The endpoint of the TGI service to which requests to this service will be sent (formed from previously set variables)
2121
export CODETRANS_LLM_ENDPOINT="http://${HOST_IP}:${CODETRANS_VLLM_SERVICE_PORT}"
@@ -24,7 +24,7 @@ export CODETRANS_LLM_ENDPOINT="http://${HOST_IP}:${CODETRANS_VLLM_SERVICE_PORT}"
2424
export CODETRANS_HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
2525

2626
### The port of the LLM service. On this port, the LLM service will accept connections
27-
export CODETRANS_LLM_SERVICE_PORT=18157
27+
export CODETRANS_LLM_SERVICE_PORT=9000
2828

2929
### The IP address or domain name of the server for CodeTrans MegaService
3030
export CODETRANS_MEGA_SERVICE_HOST_IP=${HOST_IP}
@@ -36,7 +36,7 @@ export CODETRANS_LLM_SERVICE_HOST_IP=${HOST_IP}
3636
export CODETRANS_FRONTEND_SERVICE_IP=${HOST_IP}
3737

3838
### The port of the frontend service
39-
export CODETRANS_FRONTEND_SERVICE_PORT=18155
39+
export CODETRANS_FRONTEND_SERVICE_PORT=5173
4040

4141
### Name of GenAI service for route requests to application
4242
export CODETRANS_BACKEND_SERVICE_NAME=codetrans
@@ -45,10 +45,10 @@ export CODETRANS_BACKEND_SERVICE_NAME=codetrans
4545
export CODETRANS_BACKEND_SERVICE_IP=${HOST_IP}
4646

4747
### The port of the backend service
48-
export CODETRANS_BACKEND_SERVICE_PORT=18154
48+
export CODETRANS_BACKEND_SERVICE_PORT=7777
4949

5050
### The port of the Nginx reverse proxy for application
51-
export CODETRANS_NGINX_PORT=18153
51+
export CODETRANS_NGINX_PORT=8088
5252

5353
### Endpoint of the backend service
5454
export CODETRANS_BACKEND_SERVICE_URL="http://${EXTERNAL_HOST_IP}:${CODETRANS_BACKEND_SERVICE_PORT}/v1/codetrans"

CodeTrans/tests/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# CodeTrans E2E test scripts
2+
3+
## Set the required environment variable
4+
5+
```bash
6+
export HUGGINGFACEHUB_API_TOKEN="Your_Huggingface_API_Token"
7+
```
8+
9+
## Run test
10+
11+
On Intel Xeon with TGI:
12+
13+
```bash
14+
bash test_compose_tgi_on_xeon.sh
15+
```
16+
17+
On Intel Xeon with vLLM:
18+
19+
```bash
20+
bash test_compose_on_xeon.sh
21+
```
22+
23+
On Intel Gaudi with TGI:
24+
25+
```bash
26+
bash test_compose_tgi_on_gaudi.sh
27+
```
28+
29+
On Intel Gaudi with vLLM:
30+
31+
```bash
32+
bash test_compose_on_gaudi.sh
33+
```
34+
35+
On AMD ROCm with TGI:
36+
37+
```bash
38+
bash test_compose_on_rocm.sh
39+
```
40+
41+
On AMD ROCm with vLLM:
42+
43+
```bash
44+
bash test_compose_vllm_on_rocm.sh
45+
```

CodeTrans/tests/test_compose_on_gaudi.sh

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,12 @@ function build_docker_images() {
4242
}
4343

4444
function start_services() {
45-
cd $WORKPATH/docker_compose/intel/hpu/gaudi
46-
export LLM_MODEL_ID="mistralai/Mistral-7B-Instruct-v0.3"
47-
export LLM_ENDPOINT="http://${ip_address}:8008"
48-
export LLM_COMPONENT_NAME="OpeaTextGenService"
49-
export NUM_CARDS=1
50-
export BLOCK_SIZE=128
51-
export MAX_NUM_SEQS=256
52-
export MAX_SEQ_LEN_TO_CAPTURE=2048
45+
cd $WORKPATH/docker_compose
5346
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
54-
export MEGA_SERVICE_HOST_IP=${ip_address}
55-
export LLM_SERVICE_HOST_IP=${ip_address}
56-
export BACKEND_SERVICE_ENDPOINT="http://${ip_address}:7777/v1/codetrans"
57-
export FRONTEND_SERVICE_IP=${ip_address}
58-
export FRONTEND_SERVICE_PORT=5173
59-
export BACKEND_SERVICE_NAME=codetrans
60-
export BACKEND_SERVICE_IP=${ip_address}
61-
export BACKEND_SERVICE_PORT=7777
6247
export NGINX_PORT=80
6348
export host_ip=${ip_address}
49+
source set_env.sh
50+
cd intel/hpu/gaudi
6451

6552
sed -i "s/backend_address/$ip_address/g" $WORKPATH/ui/svelte/.env
6653

CodeTrans/tests/test_compose_on_rocm.sh

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,7 @@ function build_docker_images() {
4242

4343
function start_services() {
4444
cd $WORKPATH/docker_compose/amd/gpu/rocm/
45-
export CODETRANS_TGI_SERVICE_PORT=8008
46-
export CODETRANS_LLM_SERVICE_PORT=9000
47-
export CODETRANS_LLM_MODEL_ID="Qwen/Qwen2.5-Coder-7B-Instruct"
48-
export CODETRANS_TGI_LLM_ENDPOINT="http://${ip_address}:${CODETRANS_TGI_SERVICE_PORT}"
49-
export CODETRANS_HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
50-
export CODETRANS_MEGA_SERVICE_HOST_IP=${ip_address}
51-
export CODETRANS_LLM_SERVICE_HOST_IP=${ip_address}
52-
export CODETRANS_FRONTEND_SERVICE_IP=${ip_address}
53-
export CODETRANS_FRONTEND_SERVICE_PORT=5173
54-
export CODETRANS_BACKEND_SERVICE_NAME=codetrans
55-
export CODETRANS_BACKEND_SERVICE_IP=${ip_address}
56-
export CODETRANS_BACKEND_SERVICE_PORT=7777
57-
export CODETRANS_NGINX_PORT=8088
58-
export CODETRANS_BACKEND_SERVICE_URL="http://${ip_address}:${CODETRANS_BACKEND_SERVICE_PORT}/v1/codetrans"
59-
export HOST_IP=${ip_address}
45+
source set_env.sh
6046

6147
sed -i "s/backend_address/$ip_address/g" $WORKPATH/ui/svelte/.env
6248

CodeTrans/tests/test_compose_on_xeon.sh

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,13 @@ function build_docker_images() {
4444
}
4545

4646
function start_services() {
47-
cd $WORKPATH/docker_compose/intel/cpu/xeon/
48-
export LLM_MODEL_ID="mistralai/Mistral-7B-Instruct-v0.3"
49-
export LLM_ENDPOINT="http://${ip_address}:8008"
50-
export LLM_COMPONENT_NAME="OpeaTextGenService"
47+
cd $WORKPATH/docker_compose
5148
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
52-
export MEGA_SERVICE_HOST_IP=${ip_address}
53-
export LLM_SERVICE_HOST_IP=${ip_address}
54-
export BACKEND_SERVICE_ENDPOINT="http://${ip_address}:7777/v1/codetrans"
55-
export FRONTEND_SERVICE_IP=${ip_address}
56-
export FRONTEND_SERVICE_PORT=5173
57-
export BACKEND_SERVICE_NAME=codetrans
58-
export BACKEND_SERVICE_IP=${ip_address}
59-
export BACKEND_SERVICE_PORT=7777
49+
6050
export NGINX_PORT=80
6151
export host_ip=${ip_address}
52+
source set_env.sh
53+
cd intel/cpu/xeon/
6254

6355
sed -i "s/backend_address/$ip_address/g" $WORKPATH/ui/svelte/.env
6456

CodeTrans/tests/test_compose_tgi_on_gaudi.sh

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,13 @@ function build_docker_images() {
4040
}
4141

4242
function start_services() {
43-
cd $WORKPATH/docker_compose/intel/hpu/gaudi/
44-
export LLM_MODEL_ID="mistralai/Mistral-7B-Instruct-v0.3"
45-
export LLM_ENDPOINT="http://${ip_address}:8008"
46-
export LLM_COMPONENT_NAME="OpeaTextGenService"
43+
cd $WORKPATH/docker_compose
4744
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
48-
export MEGA_SERVICE_HOST_IP=${ip_address}
49-
export LLM_SERVICE_HOST_IP=${ip_address}
50-
export BACKEND_SERVICE_ENDPOINT="http://${ip_address}:7777/v1/codetrans"
51-
export FRONTEND_SERVICE_IP=${ip_address}
52-
export FRONTEND_SERVICE_PORT=5173
53-
export BACKEND_SERVICE_NAME=codetrans
54-
export BACKEND_SERVICE_IP=${ip_address}
55-
export BACKEND_SERVICE_PORT=7777
45+
5646
export NGINX_PORT=80
5747
export host_ip=${ip_address}
48+
source set_env.sh
49+
cd intel/hpu/gaudi/
5850

5951
sed -i "s/backend_address/$ip_address/g" $WORKPATH/ui/svelte/.env
6052

CodeTrans/tests/test_compose_tgi_on_xeon.sh

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,13 @@ function build_docker_images() {
4040
}
4141

4242
function start_services() {
43-
cd $WORKPATH/docker_compose/intel/cpu/xeon/
44-
export LLM_MODEL_ID="mistralai/Mistral-7B-Instruct-v0.3"
45-
export LLM_ENDPOINT="http://${ip_address}:8008"
46-
export LLM_COMPONENT_NAME="OpeaTextGenService"
43+
cd $WORKPATH/docker_compose
4744
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
48-
export MEGA_SERVICE_HOST_IP=${ip_address}
49-
export LLM_SERVICE_HOST_IP=${ip_address}
50-
export BACKEND_SERVICE_ENDPOINT="http://${ip_address}:7777/v1/codetrans"
51-
export FRONTEND_SERVICE_IP=${ip_address}
52-
export FRONTEND_SERVICE_PORT=5173
53-
export BACKEND_SERVICE_NAME=codetrans
54-
export BACKEND_SERVICE_IP=${ip_address}
55-
export BACKEND_SERVICE_PORT=7777
45+
5646
export NGINX_PORT=80
5747
export host_ip=${ip_address}
48+
source set_env.sh
49+
cd intel/cpu/xeon/
5850

5951
sed -i "s/backend_address/$ip_address/g" $WORKPATH/ui/svelte/.env
6052

CodeTrans/tests/test_compose_vllm_on_rocm.sh

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,7 @@ function build_docker_images() {
4040

4141
function start_services() {
4242
cd $WORKPATH/docker_compose/amd/gpu/rocm/
43-
export HOST_IP=${ip_address}
44-
export CODETRANS_VLLM_SERVICE_PORT=8008
45-
export CODETRANS_LLM_SERVICE_PORT=9000
46-
export CODETRANS_LLM_MODEL_ID="Qwen/Qwen2.5-Coder-7B-Instruct"
47-
export CODETRANS_LLM_ENDPOINT="http://${ip_address}:${CODETRANS_VLLM_SERVICE_PORT}"
48-
export CODETRANS_HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
49-
export CODETRANS_MEGA_SERVICE_HOST_IP=${ip_address}
50-
export CODETRANS_LLM_SERVICE_HOST_IP=${ip_address}
51-
export CODETRANS_FRONTEND_SERVICE_IP=${ip_address}
52-
export CODETRANS_FRONTEND_SERVICE_PORT=5173
53-
export CODETRANS_BACKEND_SERVICE_NAME=codetrans
54-
export CODETRANS_BACKEND_SERVICE_IP=${ip_address}
55-
export CODETRANS_BACKEND_SERVICE_PORT=7777
56-
export CODETRANS_NGINX_PORT=8088
57-
export CODETRANS_BACKEND_SERVICE_URL="http://${ip_address}:${CODETRANS_BACKEND_SERVICE_PORT}/v1/codetrans"
58-
export HOST_IP=${ip_address}
43+
source set_env_vllm.sh
5944

6045
sed -i "s/backend_address/$ip_address/g" $WORKPATH/ui/svelte/.env
6146

0 commit comments

Comments
 (0)