Skip to content

Commit

Permalink
Merge branch 'main' into deleteResource
Browse files Browse the repository at this point in the history
  • Loading branch information
KfreeZ authored Aug 12, 2024
2 parents e3561a7 + c0d2ba6 commit cb981ce
Show file tree
Hide file tree
Showing 30 changed files with 431 additions and 172 deletions.
1 change: 1 addition & 0 deletions .github/workflows/image-build-on-manual.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
echo "nodes=$nodes" >> $GITHUB_OUTPUT
image-build:
needs: get-build-matrix
strategy:
matrix:
node: ${{ fromJSON(needs.get-build-matrix.outputs.nodes) }}
Expand Down
102 changes: 94 additions & 8 deletions .github/workflows/scripts/e2e/gmc_gaudi_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ USER_ID=$(whoami)
LOG_PATH=/home/$(whoami)/logs
CHATQNA_NAMESPACE="${APP_NAMESPACE}-chatqna"
CHATQNA_DATAPREP_NAMESPACE="${APP_NAMESPACE}-chatqna-dataprep"
CHATQNA_SWITCH_NAMESPACE="${APP_NAMESPACE}-chatqna-switch"
CODEGEN_NAMESPACE="${APP_NAMESPACE}-codegen"
CODETRANS_NAMESPACE="${APP_NAMESPACE}-codetrans"
DOCSUM_NAMESPACE="${APP_NAMESPACE}-docsum"
Expand All @@ -22,21 +23,25 @@ function validate_gmc() {
echo "validate chat-qna with dataprep"
validate_chatqna_with_dataprep

echo "validate codegen"
validate_codegen
echo "validate chat-qna in switch mode"
validate_chatqna_in_switch

echo "validate codetrans"
validate_codetrans
# echo "validate codegen"
# validate_codegen

echo "validate docsum"
validate_docsum
# echo "validate codetrans"
# validate_codetrans

# echo "validate docsum"
# validate_docsum

get_gmc_controller_logs
}

function cleanup_apps() {
echo "clean up microservice-connector"
namespaces=("$CHATQNA_NAMESPACE" "$CHATQNA_DATAPREP_NAMESPACE" "$CODEGEN_NAMESPACE" "$CODETRANS_NAMESPACE" "$DOCSUM_NAMESPACE")
# namespaces=("$CHATQNA_NAMESPACE" "$CHATQNA_DATAPREP_NAMESPACE" "$CHATQNA_SWITCH_NAMESPACE" "$CODEGEN_NAMESPACE" "$CODETRANS_NAMESPACE" "$DOCSUM_NAMESPACE")
namespaces=("$CHATQNA_NAMESPACE" "$CHATQNA_DATAPREP_NAMESPACE" "$CHATQNA_SWITCH_NAMESPACE")
for ns in "${namespaces[@]}"; do
if kubectl get namespace $ns > /dev/null 2>&1; then
echo "Deleting namespace: $ns"
Expand Down Expand Up @@ -101,7 +106,7 @@ function validate_chatqna() {
}

function validate_chatqna_with_dataprep() {
kubectl create ns $CHATQNA_DATAPREP_NAMESPACE
kubectl create ns $CHATQNA_DATAPREP_NAMESPACE
sed -i "s|namespace: chatqa|namespace: $CHATQNA_DATAPREP_NAMESPACE|g" $(pwd)/config/samples/chatQnA_dataprep_gaudi.yaml
# workaround for issue #268
yq -i '(.spec.nodes.root.steps[] | select ( .name == "Tgi")).internalService.config.MODEL_ID = "bigscience/bloom-560m"' $(pwd)/config/samples/chatQnA_dataprep_gaudi.yaml
Expand Down Expand Up @@ -178,6 +183,87 @@ function validate_chatqna_with_dataprep() {
fi
}

function validate_chatqna_in_switch() {
kubectl create ns $CHATQNA_SWITCH_NAMESPACE
sed -i "s|namespace: switch|namespace: $CHATQNA_SWITCH_NAMESPACE|g" $(pwd)/config/samples/chatQnA_switch_gaudi.yaml
# workaround for issue #268
yq -i '(.spec.nodes.root.steps[] | select ( .name == "Tgi")).internalService.config.MODEL_ID = "bigscience/bloom-560m"' $(pwd)/config/samples/chatQnA_switch_gaudi.yaml
kubectl apply -f $(pwd)/config/samples/chatQnA_switch_gaudi.yaml

# Wait until the router service is ready
echo "Waiting for the chatqa router service to be ready..."
wait_until_pod_ready "chatqna router" $CHATQNA_SWITCH_NAMESPACE "router-service"
output=$(kubectl get pods -n $CHATQNA_SWITCH_NAMESPACE)
echo $output

# deploy client pod for testing
kubectl create deployment client-test -n $CHATQNA_SWITCH_NAMESPACE --image=python:3.8.13 -- sleep infinity

# Wait until all pods are ready
wait_until_all_pod_ready $CHATQNA_SWITCH_NAMESPACE 300s
if [ $? -ne 0 ]; then
echo "Error Some pods are not ready!"
exit 1
fi

# giving time to populating data
sleep 90

kubectl get pods -n $CHATQNA_SWITCH_NAMESPACE
# send request to chatqnA
export CLIENT_POD=$(kubectl get pod -n $CHATQNA_SWITCH_NAMESPACE -l app=client-test -o jsonpath={.items..metadata.name})
echo "$CLIENT_POD"
accessUrl=$(kubectl get gmc -n $CHATQNA_SWITCH_NAMESPACE -o jsonpath="{.items[?(@.metadata.name=='switch')].status.accessUrl}")

# test the chatqna with model condition: "model-id":"intel" and "embedding-model-id":"small"
kubectl exec "$CLIENT_POD" -n $CHATQNA_SWITCH_NAMESPACE -- curl $accessUrl -X POST -d '{"text":"What is the revenue of Nike in 2023?", "model-id":"intel", "embedding-model-id":"small", "parameters":{"max_new_tokens":17, "do_sample": true}}' -H 'Content-Type: application/json' > $LOG_PATH/curl_chatqna_switch_intel.log
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "chatqna failed, please check the logs in ${LOG_PATH}!"
exit 1
fi

echo "Checking response results, make sure the output is reasonable. "
local status=false
if [[ -f $LOG_PATH/curl_chatqna_switch_intel.log ]] && \
[[ $(grep -c "[DONE]" $LOG_PATH/curl_chatqna_switch_intel.log) != 0 ]]; then
status=true
fi
if [ $status == false ]; then
if [[ -f $LOG_PATH/curl_chatqna_switch_intel.log ]]; then
cat $LOG_PATH/curl_chatqna_switch_intel.log
fi
echo "Response check failed, please check the logs in artifacts!"
exit 1
else
echo "Response check succeed!"
fi

# test the chatqna with model condition: "model-id":"llama" and "embedding-model-id":"large"
kubectl exec "$CLIENT_POD" -n $CHATQNA_SWITCH_NAMESPACE -- curl $accessUrl -X POST -d '{"text":"What is the revenue of Nike in 2023?", "model-id":"llama", "embedding-model-id":"large", "parameters":{"max_new_tokens":17, "do_sample": true}}' -H 'Content-Type: application/json' > $LOG_PATH/curl_chatqna_switch_llama.log
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "chatqna failed, please check the logs in ${LOG_PATH}!"
exit 1
fi

echo "Checking response results, make sure the output is reasonable. "
local status=false
if [[ -f $LOG_PATH/curl_chatqna_switch_llama.log ]] && \
[[ $(grep -c "[DONE]" $LOG_PATH/curl_chatqna_switch_llama.log) != 0 ]]; then
status=true
fi
if [ $status == false ]; then
if [[ -f $LOG_PATH/curl_chatqna_switch_llama.log ]]; then
cat $LOG_PATH/curl_chatqna_switch_llama.log
fi
echo "Response check failed, please check the logs in artifacts!"
exit 1
else
echo "Response check succeed!"
fi
}

function validate_codegen() {
kubectl create ns $CODEGEN_NAMESPACE
sed -i "s|namespace: codegen|namespace: $CODEGEN_NAMESPACE|g" $(pwd)/config/samples/codegen_gaudi.yaml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scripts/e2e/gmc_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function cleanup_gmc() {
if kubectl get namespace $SYSTEM_NAMESPACE > /dev/null 2>&1; then
echo "Deleting namespace: $SYSTEM_NAMESPACE"
kubectl delete namespace "$SYSTEM_NAMESPACE"
kubectl delete crd gmconnectors.gmc.opea.io
kubectl delete crd gmconnectors.gmc.opea.io || true
else
echo "Namespace $SYSTEM_NAMESPACE does not exist"
fi
Expand Down
102 changes: 94 additions & 8 deletions .github/workflows/scripts/e2e/gmc_xeon_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ USER_ID=$(whoami)
LOG_PATH=/home/$(whoami)/logs
CHATQNA_NAMESPACE="${APP_NAMESPACE}-chatqna"
CHATQNA_DATAPREP_NAMESPACE="${APP_NAMESPACE}-chatqna-dataprep"
CHATQNA_SWITCH_NAMESPACE="${APP_NAMESPACE}-chatqna-switch"
CODEGEN_NAMESPACE="${APP_NAMESPACE}-codegen"
CODETRANS_NAMESPACE="${APP_NAMESPACE}-codetrans"
DOCSUM_NAMESPACE="${APP_NAMESPACE}-docsum"
Expand All @@ -22,21 +23,25 @@ function validate_gmc() {
echo "validate chat-qna with dataprep"
validate_chatqna_with_dataprep

echo "validate codegen"
validate_codegen
echo "validate chat-qna in switch mode"
validate_chatqna_in_switch

echo "validate codetrans"
validate_codetrans
# echo "validate codegen"
# validate_codegen

echo "validate docsum"
validate_docsum
# echo "validate codetrans"
# validate_codetrans

# echo "validate docsum"
# validate_docsum

get_gmc_controller_logs
}

function cleanup_apps() {
echo "clean up microservice-connector"
namespaces=("$CHATQNA_NAMESPACE" "$CHATQNA_DATAPREP_NAMESPACE" "$CODEGEN_NAMESPACE" "$CODETRANS_NAMESPACE" "$DOCSUM_NAMESPACE")
# namespaces=("$CHATQNA_NAMESPACE" "$CHATQNA_DATAPREP_NAMESPACE" "$CHATQNA_SWITCH_NAMESPACE" "$CODEGEN_NAMESPACE" "$CODETRANS_NAMESPACE" "$DOCSUM_NAMESPACE")
namespaces=("$CHATQNA_NAMESPACE" "$CHATQNA_DATAPREP_NAMESPACE" "$CHATQNA_SWITCH_NAMESPACE")
for ns in "${namespaces[@]}"; do
if kubectl get namespace $ns > /dev/null 2>&1; then
echo "Deleting namespace: $ns"
Expand Down Expand Up @@ -103,7 +108,7 @@ function validate_chatqna() {
}

function validate_chatqna_with_dataprep() {
kubectl create ns $CHATQNA_DATAPREP_NAMESPACE
kubectl create ns $CHATQNA_DATAPREP_NAMESPACE
sed -i "s|namespace: chatqa|namespace: $CHATQNA_DATAPREP_NAMESPACE|g" $(pwd)/config/samples/chatQnA_dataprep_xeon.yaml
# workaround for issue #268
yq -i '(.spec.nodes.root.steps[] | select ( .name == "Tgi")).internalService.config.MODEL_ID = "bigscience/bloom-560m"' $(pwd)/config/samples/chatQnA_dataprep_xeon.yaml
Expand Down Expand Up @@ -180,6 +185,87 @@ function validate_chatqna_with_dataprep() {
fi
}

function validate_chatqna_in_switch() {
kubectl create ns $CHATQNA_SWITCH_NAMESPACE
sed -i "s|namespace: switch|namespace: $CHATQNA_SWITCH_NAMESPACE|g" $(pwd)/config/samples/chatQnA_switch_xeon.yaml
# workaround for issue #268
yq -i '(.spec.nodes.root.steps[] | select ( .name == "Tgi")).internalService.config.MODEL_ID = "bigscience/bloom-560m"' $(pwd)/config/samples/chatQnA_switch_xeon.yaml
kubectl apply -f $(pwd)/config/samples/chatQnA_switch_xeon.yaml

# Wait until the router service is ready
echo "Waiting for the chatqa router service to be ready..."
wait_until_pod_ready "chatqna router" $CHATQNA_SWITCH_NAMESPACE "router-service"
output=$(kubectl get pods -n $CHATQNA_SWITCH_NAMESPACE)
echo $output

# deploy client pod for testing
kubectl create deployment client-test -n $CHATQNA_SWITCH_NAMESPACE --image=python:3.8.13 -- sleep infinity

# Wait until all pods are ready
wait_until_all_pod_ready $CHATQNA_SWITCH_NAMESPACE 300s
if [ $? -ne 0 ]; then
echo "Error Some pods are not ready!"
exit 1
fi

# giving time to populating data
sleep 90

kubectl get pods -n $CHATQNA_SWITCH_NAMESPACE
# send request to chatqnA
export CLIENT_POD=$(kubectl get pod -n $CHATQNA_SWITCH_NAMESPACE -l app=client-test -o jsonpath={.items..metadata.name})
echo "$CLIENT_POD"
accessUrl=$(kubectl get gmc -n $CHATQNA_SWITCH_NAMESPACE -o jsonpath="{.items[?(@.metadata.name=='switch')].status.accessUrl}")

# test the chatqna with model condition: "model-id":"intel" and "embedding-model-id":"small"
kubectl exec "$CLIENT_POD" -n $CHATQNA_SWITCH_NAMESPACE -- curl $accessUrl -X POST -d '{"text":"What is the revenue of Nike in 2023?", "model-id":"intel", "embedding-model-id":"small", "parameters":{"max_new_tokens":17, "do_sample": true}}' -H 'Content-Type: application/json' > $LOG_PATH/curl_chatqna_switch_intel.log
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "chatqna failed, please check the logs in ${LOG_PATH}!"
exit 1
fi

echo "Checking response results, make sure the output is reasonable. "
local status=false
if [[ -f $LOG_PATH/curl_chatqna_switch_intel.log ]] && \
[[ $(grep -c "[DONE]" $LOG_PATH/curl_chatqna_switch_intel.log) != 0 ]]; then
status=true
fi
if [ $status == false ]; then
if [[ -f $LOG_PATH/curl_chatqna_switch_intel.log ]]; then
cat $LOG_PATH/curl_chatqna_switch_intel.log
fi
echo "Response check failed, please check the logs in artifacts!"
exit 1
else
echo "Response check succeed!"
fi

# test the chatqna with model condition: "model-id":"llama" and "embedding-model-id":"large"
kubectl exec "$CLIENT_POD" -n $CHATQNA_SWITCH_NAMESPACE -- curl $accessUrl -X POST -d '{"text":"What is the revenue of Nike in 2023?", "model-id":"llama", "embedding-model-id":"large", "parameters":{"max_new_tokens":17, "do_sample": true}}' -H 'Content-Type: application/json' > $LOG_PATH/curl_chatqna_switch_llama.log
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "chatqna failed, please check the logs in ${LOG_PATH}!"
exit 1
fi

echo "Checking response results, make sure the output is reasonable. "
local status=false
if [[ -f $LOG_PATH/curl_chatqna_switch_llama.log ]] && \
[[ $(grep -c "[DONE]" $LOG_PATH/curl_chatqna_switch_llama.log) != 0 ]]; then
status=true
fi
if [ $status == false ]; then
if [[ -f $LOG_PATH/curl_chatqna_switch_llama.log ]]; then
cat $LOG_PATH/curl_chatqna_switch_llama.log
fi
echo "Response check failed, please check the logs in artifacts!"
exit 1
else
echo "Response check succeed!"
fi
}

function validate_codegen() {
kubectl create ns $CODEGEN_NAMESPACE
sed -i "s|namespace: codegen|namespace: $CODEGEN_NAMESPACE|g" $(pwd)/config/samples/codegen_xeon.yaml
Expand Down
9 changes: 4 additions & 5 deletions helm-charts/chatqna/gaudi-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ tei:
resources:
limits:
habana.ai/gaudi: 1
securityContext:
readOnlyRootFilesystem: false

# To override values in subchart tgi
tgi:
Expand All @@ -17,8 +19,5 @@ tgi:
resources:
limits:
habana.ai/gaudi: 1
extraArgs:
- "--max-input-length"
- "1024"
- "--max-total-tokens"
- "2048"
MAX_INPUT_LENGTH: "1024"
MAX_TOTAL_TOKENS: "2048"
7 changes: 2 additions & 5 deletions helm-charts/codegen/gaudi-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ tgi:
resources:
limits:
habana.ai/gaudi: 1
extraArgs:
- "--max-input-length"
- "1024"
- "--max-total-tokens"
- "2048"
MAX_INPUT_LENGTH: "1024"
MAX_TOTAL_TOKENS: "2048"
7 changes: 2 additions & 5 deletions helm-charts/codetrans/gaudi-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ tgi:
resources:
limits:
habana.ai/gaudi: 1
extraArgs:
- "--max-input-length"
- "1024"
- "--max-total-tokens"
- "2048"
MAX_INPUT_LENGTH: "1024"
MAX_TOTAL_TOKENS: "2048"
6 changes: 0 additions & 6 deletions helm-charts/common/data-prep/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ spec:
- name: data-prep
containerPort: 6007
protocol: TCP
# The following need to be modified after GenAIComps bug #282 is resolved.
# https://github.com/opea-project/GenAIComps/issues/282
- containerPort: 6008
protocol: TCP
- containerPort: 6009
protocol: TCP
volumeMounts:
- mountPath: /tmp
name: tmp
Expand Down
8 changes: 3 additions & 5 deletions helm-charts/common/data-prep/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ metadata:
spec:
type: {{ .Values.service.type }}
ports:
{{- range .Values.service.ports }}
- port: {{ .port }}
targetPort: {{ .targetPort }}
- port: {{ .Values.service.port }}
targetPort: 6007
protocol: TCP
name: {{ .name }}
{{- end }}
name: data-prep
selector:
{{- include "data-prep.selectorLabels" . | nindent 4 }}
5 changes: 1 addition & 4 deletions helm-charts/common/data-prep/templates/tests/test-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@ spec:
args:
- |
echo "test file" > /tmp/file1.txt;
{{- with index .Values.service.ports 0 }}
export port={{.port}};
{{- end }}
max_retry=20;
for ((i=1; i<=max_retry; i++)); do
curl http://{{ include "data-prep.fullname" . }}:$port/v1/dataprep -sS --fail-with-body \
curl http://{{ include "data-prep.fullname" . }}:{{ .Values.service.port }}/v1/dataprep -sS --fail-with-body \
-X POST \
-H "Content-Type: multipart/form-data" \
-F "files=@/tmp/file1.txt" && break;
Expand Down
14 changes: 1 addition & 13 deletions helm-charts/common/data-prep/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,7 @@ securityContext:

service:
type: ClusterIP
# The following need to be modified after GenAIComps bug #282 is resolved.
# https://github.com/opea-project/GenAIComps/issues/282
ports:
# The default port for data prep service is 6007
- port: 6007
targetPort: 6007
name: data-prep
- port: 6008
targetPort: 6008
name: data-prep-get
- port: 6009
targetPort: 6009
name: data-prep-delete
port: 6007

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
Expand Down
Loading

0 comments on commit cb981ce

Please sign in to comment.