Skip to content

Commit

Permalink
Enable new CI runner and improve manifest e2e test scripts (#263)
Browse files Browse the repository at this point in the history
Signed-off-by: Yingchun Guo <yingchun.guo@intel.com>
  • Loading branch information
daisy-ycguo authored Jun 6, 2024
1 parent 4250048 commit 26d6ea4
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/E2E_test_with_compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
run: |
set -xe
merged_commit=$(git log -1 --format='%H')
changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${merged_commit} | \
grep -vE '.github|README.md|*.txt|deprecate|kubernetes|manifest')
changed_files="$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${merged_commit} | \
grep -vE '.github|README.md|*.txt|deprecate|kubernetes|manifest')" || true
examples=$(printf '%s\n' "${changed_files[@]}" | grep '/' | cut -d'/' -f1 | sort -u)
run_matrix="{\"include\":["
for example in ${examples}; do
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/manifest-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: |
set -xe
changed_files="$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | \
grep "/kubernetes/manifests/" | \
grep -E "/kubernetes/manifests/|test_manifest" | \
grep -vE '.github|deprecated|docker')" || true
examples=$(printf '%s\n' "${changed_files[@]}" | grep '/' | cut -d'/' -f1 | sort -u)
run_matrix="{\"include\":["
Expand All @@ -50,7 +50,7 @@ jobs:
continue # skip gaudi for K8s test temporarily
else
#lower_example=$(echo "${example}" | tr '[:upper:]' '[:lower:]')
run_matrix="${run_matrix}{\"example\":\"${example}\",\"hardware\":\"inspur-icx-1\"},"
run_matrix="${run_matrix}{\"example\":\"${example}\",\"hardware\":\"k8s\"},"
fi
done
done
Expand Down
36 changes: 18 additions & 18 deletions ChatQnA/tests/test_manifest_on_xeon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ function init_chatqna() {
# replace the repository "image: opea/*" with "image: $IMAGE_REPO/opea/"
find . -name '*.yaml' -type f -exec sed -i "s#image: opea/*#image: $IMAGE_REPO/opea/#g" {} \;
# set huggingface token
find . -name '*.yaml' -type f -exec sed -i "s#insert-your-huggingface-token-here#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \;
find . -name '*.yaml' -type f -exec sed -i "s#\${HUGGINGFACEHUB_API_TOKEN}#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \;
}

function install_chatqna {
# replace namespace "default" with real namespace
find . -name '*.yaml' -type f -exec sed -i "s#svc.default#svc.$NAMESPACE#g" {} \;
find . -name '*.yaml' -type f -exec sed -i "s#default.svc#$NAMESPACE.svc#g" {} \;
# for very yaml file in yaml_files, apply it to the k8s cluster
yaml_files=("qna_configmap_xeon" "redis-vector-db" "tei_embedding_service" "tei_reranking_service" "tgi_service" "retriever" "embedding" "reranking" "llm")
for yaml_file in ${yaml_files[@]}; do
Expand All @@ -43,28 +43,28 @@ function validate_chatqna() {
-H 'Content-Type: application/json'; do sleep 10; done

# check megaservice works
# generate a random logfile name to avoid conflict among multiple runners
LOGFILE=$LOG_PATH/curlmega_$NAMESPACE.log
curl http://chaqna-xeon-backend-server-svc.$NAMESPACE:8888/v1/chatqna -H "Content-Type: application/json" -d '{
"messages": "What is the revenue of Nike in 2023?"}' > ${LOG_PATH}/curl_megaservice.log
"messages": "What is the revenue of Nike in 2023?"}' > $LOGFILE
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "Megaservice failed, please check the logs in ${LOG_PATH}!"
echo "Megaservice failed, please check the logs in $LOGFILE!"
exit 1
fi
echo "Response check succeed!"

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

if [ $# -eq 0 ]; then
Expand Down
19 changes: 13 additions & 6 deletions CodeGen/tests/test_manifest_on_xeon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,22 @@ function validate_codegen() {
ip_address=$(kubectl get svc $SERVICE_NAME -n $NAMESPACE -o jsonpath='{.spec.clusterIP}')
port=$(kubectl get svc $SERVICE_NAME -n $NAMESPACE -o jsonpath='{.spec.ports[0].port}')
echo "try to curl http://${ip_address}:${port}/v1/codegen..."

# generate a random logfile name to avoid conflict among multiple runners
LOGFILE=$LOG_PATH/curlmega_$NAMESPACE.log
# Curl the Mega Service
curl http://${ip_address}:${port}/v1/codegen -H "Content-Type: application/json" -d '{
"model": "ise-uiuc/Magicoder-S-DS-6.7B",
"messages": "Implement a high-level API for a TODO list application. The API takes as input an operation request and updates the TODO list in place. If the request is invalid, raise an exception."}' > curl_megaservice.log
curl http://${ip_address}:${port}/v1/codegen -H "Content-Type: application/json" \
-d '{"messages": "def print_hello_world():"}' > $LOGFILE
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "Megaservice codegen failed, please check the logs in $LOGFILE!"
exit 1
fi

echo "Checking response results, make sure the output is reasonable. "
local status=true
if [[ -f curl_megaservice.log ]] && \
[[ $(grep -c "billion" curl_megaservice.log) != 0 ]]; then
local status=false
if [[ -f $LOGFILE ]] && \
[[ $(grep -c "print" $LOGFILE) != 0 ]]; then
status=true
fi

Expand Down

0 comments on commit 26d6ea4

Please sign in to comment.