Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add couler e2e test #1245

Merged
merged 1 commit into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ jobs:
- docker pull sqlflow/sqlflow:latest && docker build --cache-from sqlflow/sqlflow:latest -t sqlflow:latest -f Dockerfile .
- docker run --rm -v $GOPATH:/go -w /go/src/sqlflow.org/sqlflow sqlflow:latest bash scripts/test_units.sh
- docker run --rm -v $GOPATH:/go -w /go/src/sqlflow.org/sqlflow sqlflow:latest bash scripts/upload_coveralls.sh
- docker run --rm -v $GOPATH:/go -w /go/src/sqlflow.org/sqlflow sqlflow:latest bash scripts/test_couler.sh
- # run more parallel tests in the same stage:
env: SQLFLOW_TEST_DB=hive
script:
Expand All @@ -55,7 +54,7 @@ jobs:
script:
- docker pull sqlflow/sqlflow:latest && docker build --cache-from sqlflow/sqlflow:latest -t sqlflow:latest -f Dockerfile .
- bash scripts/setup_k8s_env.sh
- docker run --rm --net=host -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/.kube:/root/.kube -v /home/$USER/.minikube/:/home/$USER/.minikube/ -v $GOPATH:/go -w /go/src/sqlflow.org/sqlflow sqlflow:latest bash scripts/test_argo.sh
- docker run --rm --net=host -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/.kube:/root/.kube -v /home/$USER/.minikube/:/home/$USER/.minikube/ -v $GOPATH:/go -w /go/src/sqlflow.org/sqlflow sqlflow:latest bash scripts/test_couler.sh
- docker run --rm --net=host -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/.kube:/root/.kube -v /home/$USER/.minikube/:/home/$USER/.minikube/ -v $GOPATH:/go -w /go/src/sqlflow.org/sqlflow sqlflow:latest bash scripts/test_ipython.sh
- docker run -e MAXCOMPUTE_AK=$MAXCOMPUTE_AK -e MAXCOMPUTE_SK=$MAXCOMPUTE_SK --rm --net=host -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/.kube:/root/.kube -v /home/$USER/.minikube/:/home/$USER/.minikube/ -v $GOPATH:/go -w /go/src/sqlflow.org/sqlflow sqlflow:latest bash scripts/test_maxcompute.sh
- env: SQLFLOW_TEST=java
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/codegen/proto/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
intermediate_representation.pb.go
2 changes: 1 addition & 1 deletion python/couler/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
url=URL,
packages=find_packages(exclude=('tests',)),
entry_points={
'console_scripts': ['couler = couler.__main__:main'],
'console_scripts': ['couler = couler.client:main'],
},
install_requires=REQUIRED,
setup_requires=SETUP_REQUIRED,
Expand Down
37 changes: 0 additions & 37 deletions scripts/test_argo.sh

This file was deleted.

40 changes: 40 additions & 0 deletions scripts/test_couler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,46 @@

set -e

############# Run Couler unit tests #############
pip install -r python/couler/requirements.txt

pytest python/couler/tests


############# Run Couler e2e test #############
CHECK_INTERVAL_SECS=2
cd python/couler/ && python setup.py install
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default install Couler in the Docker image?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea and I will do that in the next PR.

cat <<EOF > /tmp/sqlflow_couler.py
import couler.argo as couler
couler.run_container(image="docker/whalesay", command='echo "SQLFlow bridges AI and SQL engine."')
EOF

couler run --mode argo --file /tmp/sqlflow_couler.py > /tmp/sqlflow_argo.yaml

MESSAGE=$(kubectl create -f /tmp/sqlflow_argo.yaml)

WORKFLOW_NAME=$(echo ${MESSAGE} | cut -d ' ' -f 1 | cut -d '/' -f 2)

echo WORKFLOW_NAME ${WORKFLOW_NAME}


for i in {1..30}; do
WORKFLOW_STATUS=$(kubectl get wf ${WORKFLOW_NAME} -o jsonpath='{.status.phase}')

if [[ "$WORKFLOW_STATUS" == "Succeeded" ]]; then
echo "Argo workflow succeeded."
kubectl delete wf ${WORKFLOW_NAME}
rm -rf /tmp/sqlflow*
exit 0
else
echo "Argo workflow ${WORKFLOW_NAME} ${WORKFLOW_STATUS}"
sleep ${CHECK_INTERVAL_SECS}
fi
done

echo "Argo job timed out."
rm -rf /tmp/sqlflow*
exit 1