Skip to content

CaaS - test APIs and E2E tests #2191

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

Merged
merged 41 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
89b0f4c
Remove unnecessary examples
RobertLucian May 24, 2021
747d6bb
More APIs removed
RobertLucian May 24, 2021
a68fd68
Add test apis (realtime/async)
RobertLucian May 24, 2021
83079a1
Require less memory for text-generator api
RobertLucian May 24, 2021
8b37a94
Add tensorflow cpu/gpu api
RobertLucian May 25, 2021
52a42d1
Merge branch 'feature/caas-api' into caas/test-apis
RobertLucian May 25, 2021
8c7ba0b
Changes to the realtime APIs
RobertLucian May 25, 2021
73c0419
Remove tensorflow dir from tests
RobertLucian May 25, 2021
6cfc3f2
Add iris-classifier trainer task
RobertLucian May 25, 2021
2e1b8a6
Remove more unnecessary APIs
RobertLucian May 25, 2021
db5ed8a
Add batch API
RobertLucian May 25, 2021
16d7519
Add batch submitter
RobertLucian May 25, 2021
fc9bf12
Add batch sum API
RobertLucian May 25, 2021
ab61fa0
Finalize async E2E
RobertLucian May 25, 2021
80bd36c
Finalize autoscaling E2E test
RobertLucian May 25, 2021
4e671fb
Finalize batch E2E test
RobertLucian May 25, 2021
90d1d43
Finalize load E2E test
RobertLucian May 25, 2021
45d07c2
Finalize long running E2E test
RobertLucian May 25, 2021
2a95e0c
Finalize realtime E2E test
RobertLucian May 25, 2021
b24bded
Finalize task E2E test
RobertLucian May 25, 2021
69b54a0
Add TrafficSplitter API
RobertLucian May 25, 2021
10b5ad0
Tweak make file commands to build the api images
RobertLucian May 25, 2021
1f93a17
Use the correct image names (not considering the registry) for the te…
RobertLucian May 25, 2021
d144cb0
Remove the "sample/" word from the test API images
RobertLucian May 25, 2021
96aa2fe
Fix traffic splitter image builder
RobertLucian May 25, 2021
d22d287
Use master instead of latest tag
RobertLucian May 25, 2021
cdeac2a
Fix naming scheme of container images (for APIs)
RobertLucian May 25, 2021
2d29c7e
Address some PR comments
RobertLucian May 26, 2021
142aba8
Revert to using query params for sleep API
RobertLucian May 26, 2021
0cb8c60
Create make test-images-* commands
RobertLucian May 26, 2021
e099f7d
Fixes for the E2E tests
RobertLucian May 26, 2021
686aa51
Use the correct api name for the iris-classifier trainer
RobertLucian May 26, 2021
a833339
Rename test_async_api to test_async_api_gpu
RobertLucian May 26, 2021
85b0861
update traffic splitter example
deliahu May 26, 2021
b73d66b
Address PR thoughts
RobertLucian May 27, 2021
06faae8
Create hello-world realtime API
RobertLucian May 27, 2021
38601c9
Fix naming scheme of the test api images (in make cmd)
RobertLucian May 27, 2021
aa7e53e
Minor log correction
RobertLucian May 27, 2021
fbf79de
Use quay images for the test APIs
RobertLucian May 27, 2021
dba2883
Batch sum API fix
RobertLucian May 27, 2021
56e6810
Nits
RobertLucian May 27, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 7 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ async-gateway-update:
@./dev/registry.sh update-single async-gateway
@kubectl delete pods -l cortex.dev/async=gateway --namespace=default

# Docker images

# docker images
images-all:
@./dev/registry.sh update all
images-all-skip-push:
Expand All @@ -136,15 +135,8 @@ images-dev:
images-dev-skip-push:
@./dev/registry.sh update dev --skip-push

images-api:
@./dev/registry.sh update api
images-api-skip-push:
@./dev/registry.sh update api --skip-push

images-manager-skip-push:
@./dev/registry.sh update-single manager --skip-push
images-iris:
@./dev/registry.sh update-single python-handler-cpu

registry-create:
@./dev/registry.sh create
Expand Down Expand Up @@ -179,6 +171,12 @@ test-go:
test-python:
@./build/test.sh python


# build test api images
# the DOCKER_PASSWORD and DOCKER_USERNAME vars to the quay repo are required
build-and-push-test-images:
@./test/utils/build-and-push-images.sh quay.io

# run e2e tests on an existing cluster
# read test/e2e/README.md for instructions first
test-e2e:
Expand Down
14 changes: 1 addition & 13 deletions build/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,4 @@ image=$1
if [ "$image" == "inferentia" ]; then
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 790709498068.dkr.ecr.us-west-2.amazonaws.com
fi

build_args=""

if [ "${image}" == "python-handler-gpu" ]; then
cuda=("10.0" "10.1" "10.1" "10.2" "10.2" "11.0" "11.1")
cudnn=("7" "7" "8" "7" "8" "8" "8")
for i in ${!cudnn[@]}; do
build_args="${build_args} --build-arg CUDA_VERSION=${cuda[$i]} --build-arg CUDNN=${cudnn[$i]}"
docker build "$ROOT" -f $ROOT/images/$image/Dockerfile $build_args -t quay.io/cortexlabs/${image}:${CORTEX_VERSION}-cuda${cuda[$i]}-cudnn${cudnn[$i]} -t cortexlabs/${image}:${CORTEX_VERSION}-cuda${cuda[$i]}-cudnn${cudnn[$i]}
done
else
docker build "$ROOT" -f $ROOT/images/$image/Dockerfile $build_args -t quay.io/cortexlabs/${image}:${CORTEX_VERSION} -t cortexlabs/${image}:${CORTEX_VERSION}
fi
docker build "$ROOT" -f $ROOT/images/$image/Dockerfile -t quay.io/cortexlabs/${image}:${CORTEX_VERSION} -t cortexlabs/${image}:${CORTEX_VERSION}
8 changes: 0 additions & 8 deletions build/images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@

set -euo pipefail

api_images=(
"python-handler-cpu"
"python-handler-gpu"
"tensorflow-handler"
"python-handler-inf"
)

dev_images=(
"manager"
"proxy"
Expand Down Expand Up @@ -61,7 +54,6 @@ non_dev_images=(
)

all_images=(
"${api_images[@]}"
"${dev_images[@]}"
"${non_dev_images[@]}"
)
11 changes: 1 addition & 10 deletions build/push-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,4 @@ host=$1
image=$2

echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin

if [ "$image" == "python-handler-gpu" ]; then
cuda=("10.0" "10.1" "10.1" "10.2" "10.2" "11.0" "11.1")
cudnn=("7" "7" "8" "7" "8" "8" "8")
for i in ${!cudnn[@]}; do
docker push $host/cortexlabs/${image}:${CORTEX_VERSION}-cuda${cuda[$i]}-cudnn${cudnn[$i]}
done
else
docker push $host/cortexlabs/${image}:${CORTEX_VERSION}
fi
docker push $host/cortexlabs/${image}:${CORTEX_VERSION}
19 changes: 3 additions & 16 deletions dev/export_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,10 @@ for image in "${all_images[@]}"; do
done
echo

cuda=("10.0" "10.1" "10.1" "10.2" "10.2" "11.0" "11.1")
cudnn=("7" "7" "8" "7" "8" "8" "8")

# pull the images from source registry and push them to ECR
for image in "${all_images[@]}"; do
# copy the different cuda/cudnn variations of the python handler image
if [ "$image" = "python-handler-gpu" ]; then
for i in "${!cuda[@]}"; do
full_image="$image:$cortex_version-cuda${cuda[$i]}-cudnn${cudnn[$i]}"
echo "copying $full_image from $source_registry to $destination_registry"
skopeo copy --src-no-creds "docker://$source_registry/$full_image" "docker://$destination_registry/$full_image"
echo
done
else
echo "copying $image:$cortex_version from $source_registry to $destination_registry"
skopeo copy --src-no-creds "docker://$source_registry/$image:$cortex_version" "docker://$destination_registry/$image:$cortex_version"
echo
fi
echo "copying $image:$cortex_version from $source_registry to $destination_registry"
skopeo copy --src-no-creds "docker://$source_registry/$image:$cortex_version" "docker://$destination_registry/$image:$cortex_version"
echo
done
echo "done ✓"
10 changes: 1 addition & 9 deletions dev/registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,13 @@ function build() {
local tag=$2
local dir="${ROOT}/images/${image}"

build_args=""

tag_args=""
if [ -n "$AWS_ACCOUNT_ID" ] && [ -n "$AWS_REGION" ]; then
tag_args+=" -t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/cortexlabs/$image:$tag"
fi

blue_echo "Building $image:$tag..."
docker build $ROOT -f $dir/Dockerfile -t cortexlabs/$image:$tag $tag_args $build_args
docker build $ROOT -f $dir/Dockerfile -t cortexlabs/$image:$tag $tag_args
green_echo "Built $image:$tag\n"
}

Expand Down Expand Up @@ -150,10 +148,6 @@ function build_and_push() {
set -euo pipefail # necessary since this is called in a new shell by parallel

tag=$CORTEX_VERSION
if [ "${image}" == "python-handler-gpu" ]; then
tag="${CORTEX_VERSION}-cuda10.2-cudnn8"
fi

build $image $tag
push $image $tag
}
Expand Down Expand Up @@ -240,8 +234,6 @@ elif [ "$cmd" = "update" ]; then
images_to_build+=( "${dev_images[@]}" )
fi

images_to_build+=( "${api_images[@]}" )

if [[ " ${images_to_build[@]} " =~ " operator " ]]; then
cache_builder operator
fi
Expand Down
67 changes: 0 additions & 67 deletions test/apis/README.md

This file was deleted.

11 changes: 0 additions & 11 deletions test/apis/async/iris-classifier/cortex.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions test/apis/async/iris-classifier/expectations.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions test/apis/async/iris-classifier/handler.py

This file was deleted.

2 changes: 0 additions & 2 deletions test/apis/async/iris-classifier/requirements.txt

This file was deleted.

6 changes: 0 additions & 6 deletions test/apis/async/iris-classifier/sample.json

This file was deleted.

7 changes: 0 additions & 7 deletions test/apis/async/tensorflow/cortex.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions test/apis/async/tensorflow/handler.py

This file was deleted.

6 changes: 0 additions & 6 deletions test/apis/async/tensorflow/sample.json

This file was deleted.

9 changes: 9 additions & 0 deletions test/apis/async/text-generator/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.dockerfile
README.md
sample.json
expectations.yaml
*.pyc
*.pyo
*.pyd
__pycache__
.pytest_cache
16 changes: 16 additions & 0 deletions test/apis/async/text-generator/cortex_cpu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- name: text-generator
kind: AsyncAPI
pod:
port: 9000
containers:
- name: api
image: quay.io/cortexlabs-test/async-text-generator-cpu:latest
readiness_probe:
http_get:
path: "/healthz"
port: 9000
compute:
cpu: 1
mem: 2.5G
autoscaling:
max_concurrency: 1
19 changes: 19 additions & 0 deletions test/apis/async/text-generator/cortex_gpu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
- name: text-generator
kind: AsyncAPI
pod:
port: 9000
containers:
- name: api
image: quay.io/cortexlabs-test/async-text-generator-gpu:latest
env:
TARGET_DEVICE: "cuda"
readiness_probe:
http_get:
path: "/healthz"
port: 9000
compute:
cpu: 1
gpu: 1
mem: 512M
autoscaling:
max_concurrency: 1
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ response:
json_schema:
type: "object"
properties:
label:
prediction:
type: "string"
const: "setosa"
required:
- "label"
- "prediction"
Loading