Add experimental environment: tensorflow-serving (#1212)
This commit is contained in:
@@ -40,6 +40,7 @@ build_and_push_builder $BUILDER_IMAGE:$TAG
|
||||
build_and_push_env_runtime python $REPO/python-env:$TAG
|
||||
build_and_push_env_runtime jvm $REPO/jvm-env:$TAG
|
||||
build_and_push_env_runtime go $REPO/go-env:$TAG
|
||||
build_and_push_env_runtime tensorflow-serving $REPO/tensorflow-serving-env:$TAG
|
||||
|
||||
build_and_push_env_builder python $REPO/python-env-builder:$TAG $BUILDER_IMAGE:$TAG
|
||||
build_and_push_env_builder jvm $REPO/jvm-env-builder:$TAG $BUILDER_IMAGE:$TAG
|
||||
|
||||
+5
-3
@@ -441,6 +441,7 @@ run_all_tests() {
|
||||
export GO_BUILDER_IMAGE=gcr.io/fission-ci/go-env-builder:test
|
||||
export JVM_RUNTIME_IMAGE=gcr.io/fission-ci/jvm-env:test
|
||||
export JVM_BUILDER_IMAGE=gcr.io/fission-ci/jvm-env-builder:test
|
||||
export TS_RUNTIME_IMAGE=gcr.io/fission-ci/tensorflow-serving-env:test
|
||||
|
||||
set +e
|
||||
export TIMEOUT=900 # 15 minutes per test
|
||||
@@ -448,6 +449,7 @@ run_all_tests() {
|
||||
# run tests without newdeploy in parallel.
|
||||
export JOBS=6
|
||||
$ROOT/test/run_test.sh \
|
||||
$ROOT/test/tests/test_canary.sh \
|
||||
$ROOT/test/tests/mqtrigger/kafka/test_kafka.sh \
|
||||
$ROOT/test/tests/mqtrigger/nats/test_mqtrigger.sh \
|
||||
$ROOT/test/tests/mqtrigger/nats/test_mqtrigger_error.sh \
|
||||
@@ -458,7 +460,6 @@ run_all_tests() {
|
||||
$ROOT/test/tests/test_archive_pruner.sh \
|
||||
$ROOT/test/tests/test_backend_poolmgr.sh \
|
||||
$ROOT/test/tests/test_buildermgr.sh \
|
||||
$ROOT/test/tests/test_canary.sh \
|
||||
$ROOT/test/tests/test_env_vars.sh \
|
||||
$ROOT/test/tests/test_environments/test_python_env.sh \
|
||||
$ROOT/test/tests/test_fn_update/test_idle_objects_reaper.sh \
|
||||
@@ -473,14 +474,15 @@ run_all_tests() {
|
||||
$ROOT/test/tests/test_router_cache_invalidation.sh \
|
||||
$ROOT/test/tests/test_specs/test_spec.sh \
|
||||
$ROOT/test/tests/test_specs/test_spec_multifile.sh \
|
||||
$ROOT/test/tests/test_specs/test_spec_merge/test_spec_merge.sh
|
||||
$ROOT/test/tests/test_specs/test_spec_merge/test_spec_merge.sh \
|
||||
$ROOT/test/tests/test_environments/test_tensorflow_serving_env.sh \
|
||||
$ROOT/test/tests/test_environments/test_go_env.sh
|
||||
FAILURES=$?
|
||||
|
||||
# FIXME: run tests with newdeploy one by one.
|
||||
export JOBS=1
|
||||
$ROOT/test/run_test.sh \
|
||||
$ROOT/test/tests/test_backend_newdeploy.sh \
|
||||
$ROOT/test/tests/test_environments/test_go_env.sh \
|
||||
$ROOT/test/tests/test_environments/test_java_builder.sh \
|
||||
$ROOT/test/tests/test_environments/test_java_env.sh \
|
||||
$ROOT/test/tests/test_fn_update/test_configmap_update.sh \
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
source $(dirname $0)/../../utils.sh
|
||||
|
||||
TEST_ID=$(generate_test_id)
|
||||
echo "TEST_ID = $TEST_ID"
|
||||
|
||||
tmp_dir="/tmp/test-$TEST_ID"
|
||||
mkdir -p $tmp_dir
|
||||
|
||||
ROOT=$(dirname $0)/../../..
|
||||
|
||||
cleanup() {
|
||||
clean_resource_by_id $TEST_ID
|
||||
rm -rf $tmp_dir
|
||||
}
|
||||
|
||||
if [ -z "${TEST_NOCLEANUP:-}" ]; then
|
||||
trap cleanup EXIT
|
||||
else
|
||||
log "TEST_NOCLEANUP is set; not cleaning up test artifacts afterwards."
|
||||
fi
|
||||
|
||||
env=ts-$TEST_ID
|
||||
fn_poolmgr=hello-ts-poolmgr-$TEST_ID
|
||||
fn_nd=hello-ts-nd-$TEST_ID
|
||||
|
||||
cd $ROOT/examples/tensorflow-serving
|
||||
|
||||
log "Creating environment for Tensorflow Serving"
|
||||
fission env create --name $env --image $TS_RUNTIME_IMAGE --version 2 --period 5
|
||||
|
||||
zip -r half_plus_two.zip ./half_plus_two
|
||||
|
||||
pkgName=$(fission package create --deploy half_plus_two.zip --env $env| cut -f2 -d' '| tr -d \')
|
||||
|
||||
# wait for build to finish at most 90s
|
||||
timeout 90 bash -c "waitBuild $pkgName"
|
||||
|
||||
log "Creating pool manager & new deployment function for Tensorflow Serving"
|
||||
fission fn create --name $fn_poolmgr --env $env --pkg $pkgName --entrypoint "half_plus_two"
|
||||
fission fn create --name $fn_nd --env $env --pkg $pkgName --entrypoint "half_plus_two" --executortype newdeploy
|
||||
|
||||
log "Creating route for new deployment function"
|
||||
fission route create --function $fn_poolmgr --url /$fn_poolmgr --method POST
|
||||
fission route create --function $fn_nd --url /$fn_nd --method POST
|
||||
|
||||
log "Waiting for router & pools to catch up"
|
||||
sleep 5
|
||||
|
||||
body='{\"instances\": [1.0, 2.0, 5.0]}'
|
||||
expect='\"predictions\": \[2.5, 3.0, 4.5'
|
||||
|
||||
log "Testing pool manager function"
|
||||
timeout 60 bash -c "test_post_route $fn_poolmgr \"$body\" \"$expect\""
|
||||
|
||||
log "Testing new deployment function"
|
||||
timeout 60 bash -c "test_post_route $fn_nd \"$body\" \"$expect\""
|
||||
|
||||
log "Test PASSED"
|
||||
+33
-1
@@ -71,6 +71,35 @@ test_fn() {
|
||||
}
|
||||
export -f test_fn
|
||||
|
||||
test_post_route() {
|
||||
# Doing an HTTP POST on the function's route
|
||||
# Checking for valid response
|
||||
url="http://$FISSION_ROUTER/$1"
|
||||
body=$2
|
||||
expect=$3
|
||||
|
||||
set +e
|
||||
while true; do
|
||||
log "test_post_route: call curl"
|
||||
resp=$(curl --silent --show-error -d "$body" -X POST "$url")
|
||||
status_code=$?
|
||||
if [ $status_code -ne 0 ]; then
|
||||
log "test_post_route: curl failed ($status_code). Retrying ..."
|
||||
sleep 1
|
||||
continue
|
||||
fi
|
||||
if ! (echo $resp | grep "$expect" > /dev/null); then
|
||||
log "test_post_route: resp = '$resp' expect = '$expect'"
|
||||
log "test_post_route: expected string not found. Retrying ..."
|
||||
sleep 1
|
||||
continue
|
||||
fi
|
||||
break
|
||||
done
|
||||
set -e
|
||||
}
|
||||
export -f test_post_route
|
||||
|
||||
wait_for_builder() {
|
||||
env=$1
|
||||
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
|
||||
@@ -108,7 +137,9 @@ export -f waitBuild
|
||||
export FISSION_NAMESPACE=${FISSION_NAMESPACE:-fission}
|
||||
export FUNCTION_NAMESPACE=${FUNCTION_NAMESPACE:-fission-function}
|
||||
|
||||
export FISSION_ROUTER=$(kubectl -n $FISSION_NAMESPACE get svc router -o jsonpath='{...ip}')
|
||||
router=$(kubectl -n $FISSION_NAMESPACE get svc router -o jsonpath='{...ip}')
|
||||
|
||||
export FISSION_ROUTER=${FISSION_ROUTER:-$router}
|
||||
export FISSION_NATS_STREAMING_URL="http://defaultFissionAuthToken@$(kubectl -n $FISSION_NAMESPACE get svc nats-streaming -o jsonpath='{...ip}:{.spec.ports[0].port}')"
|
||||
|
||||
## Parameters used by some specific test cases
|
||||
@@ -119,4 +150,5 @@ export GO_BUILDER_IMAGE=${GO_BUILDER_IMAGE:-fission/go-builder}
|
||||
export JVM_RUNTIME_IMAGE=${JVM_RUNTIME_IMAGE:-fission/jvm-env}
|
||||
export JVM_BUILDER_IMAGE=${JVM_BUILDER_IMAGE:-fission/jvm-builder}
|
||||
export NODE_RUNTIME_IMAGE=${NODE_RUNTIME_IMAGE:-fission/node-env}
|
||||
export TS_RUNTIME_IMAGE=${TS_RUNTIME_IMAGE:-fission/tensorflow-serving-env}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user