From bfe467ca92d9a429a5bb57d248aa62826f905046 Mon Sep 17 00:00:00 2001 From: Katherine Yang <80359429+jbkyang-nvi@users.noreply.github.com> Date: Fri, 7 Jul 2023 15:05:12 -0700 Subject: [PATCH] Allow uncompressed conda execution enviroments (#6005) Add test for uncompressed conda execution enviroments --- qa/L0_backend_python/common.sh | 12 ++++++++++-- qa/L0_backend_python/env/test.sh | 28 ++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/qa/L0_backend_python/common.sh b/qa/L0_backend_python/common.sh index 6cda002045..074ad26da0 100644 --- a/qa/L0_backend_python/common.sh +++ b/qa/L0_backend_python/common.sh @@ -56,13 +56,21 @@ install_build_deps() { } create_conda_env() { - python_version=$1 - env_name=$2 + local python_version=$1 + local env_name=$2 conda create -n $env_name python=$python_version -y conda activate $env_name conda install -c conda-forge conda-pack -y } +create_conda_env_with_specified_path() { + local python_version=$1 + local env_path=$2 + conda create -p $env_path python=$python_version -y + conda activate $env_path + conda install -c conda-forge conda-pack -y +} + create_python_backend_stub() { rm -rf python_backend git clone https://github.com/triton-inference-server/python_backend -b $PYTHON_BACKEND_REPO_TAG diff --git a/qa/L0_backend_python/env/test.sh b/qa/L0_backend_python/env/test.sh index 48957bc311..a32c4036a4 100644 --- a/qa/L0_backend_python/env/test.sh +++ b/qa/L0_backend_python/env/test.sh @@ -30,7 +30,7 @@ source ../common.sh source ../../common/util.sh SERVER=/opt/tritonserver/bin/tritonserver -BASE_SERVER_ARGS="--model-repository=`pwd`/models --log-verbose=1 --strict-model-config=false" +BASE_SERVER_ARGS="--model-repository=`pwd`/models --log-verbose=1 --disable-auto-complete-config" PYTHON_BACKEND_BRANCH=$PYTHON_BACKEND_REPO_TAG SERVER_ARGS=$BASE_SERVER_ARGS SERVER_LOG="./inference_server.log" @@ -63,6 +63,30 @@ cp ../../python_models/python_version/model.py ./models/python_3_7/1/ cp python_backend/builddir/triton_python_backend_stub ./models/python_3_7 conda deactivate +# Use python-3-7 without conda pack +# Create a model with python 3.7 version and numpy 1.20.3 to distinguish from +# previous test. +# Tensorflow 2.1.0 only works with Python 3.4 - 3.7. Successful execution of +# the Python model indicates that the environment has been setup correctly. +path_to_conda_pack="$PWD/python-3-7-1" +create_conda_env_with_specified_path "3.7" $path_to_conda_pack +conda install numpy=1.20.3 -y +conda install tensorflow=2.1.0 -y +conda install -c conda-forge libstdcxx-ng=12 -y + +PY37_1_VERSION_STRING="Python version is 3.7, NumPy version is 1.20.3, and Tensorflow version is 2.1.0" +create_python_backend_stub +mkdir -p models/python_3_7_1/1/ +cp ../../python_models/python_version/config.pbtxt ./models/python_3_7_1 +(cd models/python_3_7_1 && \ + sed -i "s/^name:.*/name: \"python_3_7_1\"/" config.pbtxt && \ + echo "parameters: {key: \"EXECUTION_ENV_PATH\", value: {string_value: \"$path_to_conda_pack\"}}">> config.pbtxt) +cp ../../python_models/python_version/model.py ./models/python_3_7_1/1/ +# Copy activate script to folder +cp $path_to_conda_pack/lib/python3.7/site-packages/conda_pack/scripts/posix/activate $path_to_conda_pack/bin/. +cp python_backend/builddir/triton_python_backend_stub ./models/python_3_7_1 +conda deactivate + # Create a model with python 3.6 version # Tensorflow 2.1.0 only works with Python 3.4 - 3.7. Successful execution of # the Python model indicates that the environment has been setup correctly. @@ -115,7 +139,7 @@ kill $SERVER_PID wait $SERVER_PID set +e -for EXPECTED_VERSION_STRING in "$PY36_VERSION_STRING" "$PY37_VERSION_STRING" "$PY310_VERSION_STRING"; do +for EXPECTED_VERSION_STRING in "$PY36_VERSION_STRING" "$PY37_VERSION_STRING" "$PY37_1_VERSION_STRING" "$PY310_VERSION_STRING"; do grep "$EXPECTED_VERSION_STRING" $SERVER_LOG if [ $? -ne 0 ]; then cat $SERVER_LOG