Skip to content

Commit

Permalink
Allow uncompressed conda execution enviroments (triton-inference-serv…
Browse files Browse the repository at this point in the history
…er#6005)

Add test for uncompressed conda execution enviroments
  • Loading branch information
jbkyang-nvi committed Jul 7, 2023
1 parent 0edd8a7 commit bfe467c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
12 changes: 10 additions & 2 deletions qa/L0_backend_python/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 26 additions & 2 deletions qa/L0_backend_python/env/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bfe467c

Please sign in to comment.