Skip to content

Commit f57e30d

Browse files
authored
GenAIComps microservices refactor (opea-project#1072)
Signed-off-by: Xinyao Wang <xinyao.wang@intel.com> Signed-off-by: lvliang-intel <liang1.lv@intel.com> Signed-off-by: letonghan <letong.han@intel.com> Signed-off-by: Wang, Kai Lawrence <kai.lawrence.wang@intel.com> Signed-off-by: Wang, Xigui <xigui.wang@intel.com> Signed-off-by: chensuyue <suyue.chen@intel.com> Signed-off-by: WenjiaoYue <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>
1 parent 2cfd014 commit f57e30d

File tree

276 files changed

+3836
-5053
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+3836
-5053
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Copyright (C) 2024 Intel Corporation
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# this file should be run in the root of the repo
54
services:
65
nginx:
76
build:
8-
dockerfile: comps/nginx/Dockerfile
7+
dockerfile: comps/3rd_parties/nginx/src/Dockerfile
98
image: ${REGISTRY:-opea}/nginx:${TAG:-latest}

.github/workflows/docker/compose/dataprep-compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
# this file should be run in the root of the repo
55
services:
6+
dataprep:
7+
build:
8+
dockerfile: comps/dataprep/src/Dockerfile
9+
image: ${REGISTRY:-opea}/dataprep:${TAG:-latest}
610
dataprep-redis:
711
build:
812
dockerfile: comps/dataprep/redis/langchain/Dockerfile

.github/workflows/docker/compose/embeddings-compose.yaml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,25 @@
55
services:
66
embedding-tei:
77
build:
8-
dockerfile: comps/embeddings/tei/langchain/Dockerfile
8+
dockerfile: comps/embeddings/src/Dockerfile
99
image: ${REGISTRY:-opea}/embedding-tei:${TAG:-latest}
1010
embedding-multimodal-clip:
1111
build:
12-
dockerfile: comps/embeddings/multimodal_clip/Dockerfile
12+
dockerfile: comps/embeddings/src/integrations/dependency/clip/Dockerfile
1313
image: ${REGISTRY:-opea}/embedding-multimodal-clip:${TAG:-latest}
1414
embedding-multimodal-bridgetower:
1515
build:
16-
dockerfile: comps/embeddings/multimodal/bridgetower/Dockerfile
16+
dockerfile: comps/embeddings/src/integrations/dependency/bridgetower/Dockerfile
1717
image: ${REGISTRY:-opea}/embedding-multimodal-bridgetower:${TAG:-latest}
1818
embedding-multimodal:
1919
build:
20-
dockerfile: comps/embeddings/multimodal/multimodal_langchain/Dockerfile
20+
dockerfile: comps/embeddings/src/Dockerfile
2121
image: ${REGISTRY:-opea}/embedding-multimodal:${TAG:-latest}
22-
embedding-langchain-mosec-endpoint:
23-
build:
24-
dockerfile: comps/embeddings/mosec/langchain/dependency/Dockerfile
25-
image: ${REGISTRY:-opea}/embedding-langchain-mosec-endpoint:${TAG:-latest}
26-
embedding-langchain-mosec:
27-
build:
28-
dockerfile: comps/embeddings/mosec/langchain/Dockerfile
29-
image: ${REGISTRY:-opea}/embedding-langchain-mosec:${TAG:-latest}
30-
embedding-tei-llama-index:
31-
build:
32-
dockerfile: comps/embeddings/tei/llama_index/Dockerfile
33-
image: ${REGISTRY:-opea}/embedding-tei-llama-index:${TAG:-latest}
3422
embedding-multimodal-bridgetower-gaudi:
3523
build:
36-
dockerfile: comps/embeddings/multimodal/bridgetower/Dockerfile.intel_hpu
24+
dockerfile: comps/embeddings/src/integrations/dependency/bridgetower/Dockerfile.intel_hpu
3725
image: ${REGISTRY:-opea}/embedding-multimodal-bridgetower-gaudi:${TAG:-latest}
3826
embedding-predictionguard:
3927
build:
40-
dockerfile: comps/embeddings/predictionguard/Dockerfile
28+
dockerfile: comps/embeddings/src/Dockerfile
4129
image: ${REGISTRY:-opea}/embedding-predictionguard:${TAG:-latest}
42-
embedding-reranking-local:
43-
build:
44-
dockerfile: comps/embeddings/tei/langchain/Dockerfile.dynamic_batching
45-
image: ${REGISTRY:-opea}/embedding-reranking-local:${TAG:-latest}

.github/workflows/docker/compose/llms-compose.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
services:
66
llm-tgi:
77
build:
8-
dockerfile: comps/llms/text-generation/tgi/Dockerfile
8+
dockerfile: comps/llms/src/text-generation/Dockerfile
99
image: ${REGISTRY:-opea}/llm-tgi:${TAG:-latest}
1010
llm-ollama:
1111
build:
@@ -21,7 +21,7 @@ services:
2121
image: ${REGISTRY:-opea}/llm-faqgen-tgi:${TAG:-latest}
2222
llm-vllm:
2323
build:
24-
dockerfile: comps/llms/text-generation/vllm/langchain/Dockerfile
24+
dockerfile: comps/llms/src/text-generation/Dockerfile
2525
image: ${REGISTRY:-opea}/llm-vllm:${TAG:-latest}
2626
llm-native:
2727
build:
@@ -50,10 +50,6 @@ services:
5050
build:
5151
dockerfile: comps/llms/utils/lm-eval/Dockerfile
5252
image: ${REGISTRY:-opea}/llm-eval:${TAG:-latest}
53-
llm-vllm-llamaindex:
54-
build:
55-
dockerfile: comps/llms/text-generation/vllm/llama_index/Dockerfile
56-
image: ${REGISTRY:-opea}/llm-vllm-llamaindex:${TAG:-latest}
5753
llm-textgen-predictionguard:
5854
build:
5955
dockerfile: comps/llms/text-generation/predictionguard/Dockerfile

.github/workflows/docker/compose/ragas-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
services:
44
ragas:
55
build:
6-
dockerfile: comps/ragas/tgi/langchain/Dockerfile
6+
dockerfile: comps/ragas/src/tgi/langchain/Dockerfile
77
image: ${REGISTRY:-opea}/ragas:${TAG:-latest}

.github/workflows/docker/compose/reranks-compose.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,13 @@
55
services:
66
reranking-tei:
77
build:
8-
dockerfile: comps/reranks/tei/Dockerfile
8+
dockerfile: comps/reranks/src/Dockerfile
99
image: ${REGISTRY:-opea}/reranking-tei:${TAG:-latest}
1010
reranking-videoqna:
1111
build:
12-
dockerfile: comps/reranks/videoqna/Dockerfile
12+
dockerfile: comps/reranks/src/Dockerfile # TODO. need to update
1313
image: ${REGISTRY:-opea}/reranking-videoqna:${TAG:-latest}
1414
reranking-fastrag:
1515
build:
16-
dockerfile: comps/reranks/fastrag/Dockerfile
16+
dockerfile: comps/reranks/src/Dockerfile # TODO. need to update
1717
image: ${REGISTRY:-opea}/reranking-fastrag:${TAG:-latest}
18-
reranking-langchain-mosec-endpoint:
19-
build:
20-
dockerfile: comps/reranks/mosec/langchain/dependency/Dockerfile
21-
image: ${REGISTRY:-opea}/reranking-langchain-mosec-endpoint:${TAG:-latest}
22-
reranking-langchain-mosec:
23-
build:
24-
dockerfile: comps/reranks/mosec/langchain/Dockerfile
25-
image: ${REGISTRY:-opea}/reranking-langchain-mosec:${TAG:-latest}

.github/workflows/docker/compose/retrievers-compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
# this file should be run in the root of the repo
55
services:
6+
retriever:
7+
build:
8+
dockerfile: comps/retrievers/src/Dockerfile
9+
image: ${REGISTRY:-opea}/retriever:${TAG:-latest}
610
retriever-redis:
711
build:
812
dockerfile: comps/retrievers/redis/langchain/Dockerfile

.github/workflows/pr-examples-test.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ on:
1010
paths:
1111
- .github/workflows/pr-examples-test.yml
1212
- comps/cores/**
13-
- comps/embeddings/langchain/**
14-
- comps/retrievers/langchain/redis/**
15-
- comps/reranks/tei/**
16-
- comps/llms/text-generation/tgi/**
17-
- comps/dataprep/redis/langchain/**
13+
- comps/dataprep/src/redis/langchain/**
14+
- comps/retrievers/src/redis/langchain/**
1815
- requirements.txt
1916
- "!**.md"
2017

.github/workflows/pr-microservice-test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ jobs:
5252
hardware: ${{ matrix.hardware }}
5353
run: |
5454
cd tests
55-
echo "log_name=${service}_${hardware}" >> $GITHUB_ENV
56-
if [ ${hardware} = "intel_cpu" ]; then on_hw=""; else on_hw="_on_${hardware}"; fi
57-
timeout 60m bash $(find . -type f -name test_${service}${on_hw}.sh)
55+
echo "log_name=${service}" >> $GITHUB_ENV
56+
timeout 60m bash $(find . -type f -name test_${service}.sh)
5857
5958
- name: Clean up container
6059
if: cancelled() || failure()

.github/workflows/scripts/get_test_matrix.sh

Lines changed: 79 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,79 +5,128 @@
55
# service: service path name, like 'agent_langchain', 'asr_whisper'
66
# hardware: 'intel_cpu', 'intel_hpu', ...
77

8-
set -xe
8+
set -e
99
cd $WORKSPACE
1010
changed_files_full=$changed_files_full
1111
run_matrix="{\"include\":["
1212

1313
# add test services when comps code change
1414
function find_test_1() {
15-
local pre_service=$1
15+
local pre_service_path=$1
1616
local n=$2
1717
local all_service=$3
1818

19-
common_file_change=$(printf '%s\n' "${changed_files[@]}"| grep ${pre_service} | cut -d'/' -f$n | grep -E '*.py' | grep -vE '__init__.py|version.py' | sort -u) || true
19+
common_file_change=$(printf '%s\n' "${changed_files[@]}"| grep ${pre_service_path} | cut -d'/' -f$n | grep -E '*.py' | grep -vE '__init__.py|version.py' | sort -u) || true
2020
if [ "$common_file_change" ] || [ "$all_service" = "true" ]; then
2121
# if common files changed, run all services
22-
services=$(ls ${pre_service} | cut -d'/' -f$n | grep -vE '*.md|*.py|*.sh|*.yaml|*.yml|*.pdf' | sort -u) || true
22+
services=$(ls ${pre_service_path} | cut -d'/' -f$n | grep -vE '*.md|*.py|*.sh|*.yaml|*.yml|*.pdf' | sort -u) || true
2323
all_service="true"
2424
else
2525
# if specific service files changed, only run the specific service
26-
services=$(printf '%s\n' "${changed_files[@]}"| grep ${pre_service} | cut -d'/' -f$n | grep -vE '*.py|*.sh|*.yaml|*.yml|*.pdf' | sort -u) || true
26+
services=$(printf '%s\n' "${changed_files[@]}"| grep ${pre_service_path} | cut -d'/' -f$n | grep -vE '*.py|*.sh|*.yaml|*.yml|*.pdf' | sort -u) || true
2727
fi
2828

2929
for service in ${services}; do
30-
service=$pre_service/$service
31-
if [[ $(ls ${service} | grep -E "Dockerfile*") ]]; then
32-
service_name=$(echo $service | tr '/' '_' | cut -c7-) # comps/dataprep/redis/langchain -> dataprep_redis_langchain
33-
default_service_script_path=$(find ./tests -type f -name test_${service_name}.sh) || true
34-
if [ "$default_service_script_path" ]; then
35-
run_matrix="${run_matrix}{\"service\":\"${service_name}\",\"hardware\":\"intel_cpu\"},"
30+
service_path=$pre_service_path/$service
31+
if [[ $(ls ${service_path} | grep -E "Dockerfile*") ]]; then
32+
if [[ $(ls ${service_path} | grep "integrations") ]]; then
33+
# new org with `src` and `integrations` folder
34+
run_all_interation="false"
35+
service_name=$(echo $service_path | sed 's:/src::' | tr '/' '_' | cut -c7-) # comps/retrievers/src/redis/langchain -> retrievers_redis_langchain
36+
common_file_change_insight=$(printf '%s\n' "${changed_files[@]}"| grep ${service_path} | grep -vE 'integrations' | sort -u) || true
37+
if [ "$common_file_change_insight" ]; then
38+
# if common file changed, run all integrations
39+
run_all_interation="true"
40+
fi
41+
if [ "$run_all_interation" = "false" ]; then
42+
changed_integrations=$(printf '%s\n' "${changed_files[@]}"| grep ${service_path} | grep -E 'integrations' | cut -d'/' -f$((n+2)) | cut -d'.' -f1 | sort -u) || true
43+
for integration in ${changed_integrations}; do
44+
# Accurate matching test scripts
45+
# find_test=$(find ./tests -type f \( -name test_${service_name}_${integration}.sh -o -name test_${service_name}_${integration}_on_*.sh \)) || true
46+
# Fuzzy matching test scripts, for example, llms/src/text-generation/integrations/opea.py match several tests.
47+
find_test=$(find ./tests -type f -name test_${service_name}_${integration}*.sh) || true
48+
if [ "$find_test" ]; then
49+
fill_in_matrix "$find_test"
50+
else
51+
run_all_interation="true"
52+
break
53+
fi
54+
done
55+
fi
56+
if [ "$run_all_interation" = "true" ]; then
57+
find_test=$(find ./tests -type f -name test_${service_name}*.sh) || true
58+
if [ "$find_test" ]; then
59+
fill_in_matrix "$find_test"
60+
fi
61+
fi
62+
else
63+
# old org without 'src' folder
64+
service_name=$(echo $service_path | tr '/' '_' | cut -c7-) # comps/retrievers/redis/langchain -> retrievers_redis_langchain
65+
find_test=$(find ./tests -type f -name test_${service_name}*.sh) || true
66+
if [ "$find_test" ]; then
67+
fill_in_matrix "$find_test"
68+
fi
3669
fi
37-
other_service_script_path=$(find ./tests -type f -name test_${service_name}_on_*.sh) || true
38-
for script in ${other_service_script_path}; do
39-
_service=$(echo $script | cut -d'/' -f4 | cut -d'.' -f1 | cut -c6-)
40-
hardware=${_service#*_on_}
41-
run_matrix="${run_matrix}{\"service\":\"${service_name}\",\"hardware\":\"${hardware}\"},"
42-
done
4370
else
44-
find_test_1 $service $((n+1)) $all_service
71+
find_test_1 $service_path $((n+1)) $all_service
4572
fi
4673
done
4774
}
4875

76+
function fill_in_matrix() {
77+
find_test=$1
78+
for test in ${find_test}; do
79+
_service=$(echo $test | cut -d'/' -f4 | cut -d'.' -f1 | cut -c6-)
80+
_fill_in_matrix $_service
81+
done
82+
}
83+
84+
function _fill_in_matrix() {
85+
_service=$1
86+
if [ $(echo ${_service} | grep -c "_on_") == 0 ]; then
87+
service=${_service}
88+
hardware="intel_cpu"
89+
else
90+
hardware=${_service#*_on_}
91+
fi
92+
echo "service=${_service}, hardware=${hardware}"
93+
if [[ $(echo ${run_matrix} | grep -c "{\"service\":\"${_service}\",\"hardware\":\"${hardware}\"},") == 0 ]]; then
94+
run_matrix="${run_matrix}{\"service\":\"${_service}\",\"hardware\":\"${hardware}\"},"
95+
echo "------------------ add one service ------------------"
96+
fi
97+
sleep 1s
98+
}
99+
49100
# add test case when test scripts code change
50101
function find_test_2() {
51102
test_files=$(printf '%s\n' "${changed_files[@]}" | grep -E "*.sh") || true
52103
for test_file in ${test_files}; do
53-
_service=$(echo $test_file | cut -d'/' -f3 | cut -d'.' -f1 | cut -c6-)
54-
if [ $(echo ${_service} | grep -c "_on_") == 0 ]; then
55-
service=${_service}
56-
hardware="intel_cpu"
57-
else
58-
service=${_service%_on_*}
59-
hardware=${_service#*_on_}
60-
fi
61-
if [[ $(echo ${run_matrix} | grep -c "{\"service\":\"${service}\",\"hardware\":\"${hardware}\"},") == 0 ]]; then
62-
run_matrix="${run_matrix}{\"service\":\"${service}\",\"hardware\":\"${hardware}\"},"
104+
if [ -f $test_file ]; then
105+
_service=$(echo $test_file | cut -d'/' -f3 | cut -d'.' -f1 | cut -c6-)
106+
_fill_in_matrix $_service
63107
fi
64108
done
65109
}
66110

67111
function main() {
68112

69-
changed_files=$(printf '%s\n' "${changed_files_full[@]}" | grep 'comps/' | grep -vE '*.md|comps/cores') || true
113+
changed_files=$(printf '%s\n' "${changed_files_full[@]}" | grep 'comps/' | grep -vE '*.md|comps/cores|comps/3rd_parties|deployment|*.yaml') || true
114+
echo "===========start find_test_1============"
115+
echo "changed_files=${changed_files}"
70116
find_test_1 "comps" 2 false
71117
sleep 1s
118+
echo "run_matrix=${run_matrix}"
72119
echo "===========finish find_test_1============"
73120

74121
changed_files=$(printf '%s\n' "${changed_files_full[@]}" | grep 'tests/' | grep -vE '*.md|*.txt|tests/cores') || true
122+
echo "===========start find_test_2============"
123+
echo "changed_files=${changed_files}"
75124
find_test_2
76125
sleep 1s
126+
echo "run_matrix=${run_matrix}"
77127
echo "===========finish find_test_2============"
78128

79129
run_matrix=$run_matrix"]}"
80-
echo "run_matrix=${run_matrix}"
81130
echo "run_matrix=${run_matrix}" >> $GITHUB_OUTPUT
82131
}
83132

0 commit comments

Comments
 (0)