-
Notifications
You must be signed in to change notification settings - Fork 871
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'stage_release' into issue_98
- Loading branch information
Showing
9 changed files
with
215 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
FROM ubuntu:18.04 | ||
|
||
ENV PYTHONUNBUFFERED TRUE | ||
|
||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ | ||
fakeroot \ | ||
ca-certificates \ | ||
dpkg-dev \ | ||
g++ \ | ||
python3-dev \ | ||
curl \ | ||
vim \ | ||
openjdk-11-jdk \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& cd /tmp \ | ||
&& curl -O https://bootstrap.pypa.io/get-pip.py \ | ||
&& python3 get-pip.py | ||
|
||
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 | ||
RUN update-alternatives --install /usr/local/bin/pip pip /usr/local/bin/pip3 1 | ||
|
||
RUN pip install torch torchvision -f https://download.pytorch.org/whl/torch_stable.html | ||
|
||
ENV JAVA_VERSION=11 \ | ||
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64" \ | ||
JDK_HOME="/usr/lib/jvm/java-11-openjdk-amd64" \ | ||
JRE_HOME="/usr/lib/jvm/java-11-openjdk-amd64" \ | ||
ANT_VERSION=1.10.3 \ | ||
MAVEN_HOME="/opt/maven" \ | ||
MAVEN_VERSION=3.5.4 \ | ||
MAVEN_CONFIG="/root/.m2" \ | ||
MAVEN_DOWNLOAD_SHA1="22cac91b3557586bb1eba326f2f7727543ff15e3" | ||
|
||
# Install Maven | ||
RUN set -ex \ | ||
&& mkdir -p $MAVEN_HOME \ | ||
&& curl -LSso /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz https://apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \ | ||
&& echo "$MAVEN_DOWNLOAD_SHA1 /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz" | sha1sum -c - \ | ||
&& tar xzvf /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz -C $MAVEN_HOME --strip-components=1 \ | ||
&& update-alternatives --install /usr/bin/mvn mvn /opt/maven/bin/mvn 10000 \ | ||
&& mkdir -p $MAVEN_CONFIG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
FROM nvidia/cuda:10.1-cudnn7-runtime-ubuntu18.04 | ||
|
||
ENV PYTHONUNBUFFERED TRUE | ||
|
||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ | ||
fakeroot \ | ||
ca-certificates \ | ||
dpkg-dev \ | ||
g++ \ | ||
python3-dev \ | ||
curl \ | ||
vim \ | ||
openjdk-11-jdk \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& cd /tmp \ | ||
&& curl -O https://bootstrap.pypa.io/get-pip.py \ | ||
&& python3 get-pip.py | ||
|
||
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 | ||
RUN update-alternatives --install /usr/local/bin/pip pip /usr/local/bin/pip3 1 | ||
|
||
RUN pip install torch torchvision | ||
|
||
ENV JAVA_VERSION=11 \ | ||
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64" \ | ||
JDK_HOME="/usr/lib/jvm/java-11-openjdk-amd64" \ | ||
JRE_HOME="/usr/lib/jvm/java-11-openjdk-amd64" \ | ||
ANT_VERSION=1.10.3 \ | ||
MAVEN_HOME="/opt/maven" \ | ||
MAVEN_VERSION=3.5.4 \ | ||
MAVEN_CONFIG="/root/.m2" \ | ||
MAVEN_DOWNLOAD_SHA1="22cac91b3557586bb1eba326f2f7727543ff15e3" | ||
|
||
# Install Maven | ||
RUN set -ex \ | ||
&& mkdir -p $MAVEN_HOME \ | ||
&& curl -LSso /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz https://apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \ | ||
&& echo "$MAVEN_DOWNLOAD_SHA1 /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz" | sha1sum -c - \ | ||
&& tar xzvf /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz -C $MAVEN_HOME --strip-components=1 \ | ||
&& update-alternatives --install /usr/bin/mvn mvn /opt/maven/bin/mvn 10000 \ | ||
&& mkdir -p $MAVEN_CONFIG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#!/bin/bash | ||
set -euxo pipefail | ||
|
||
cleanup() | ||
{ | ||
torchserve --stop | ||
|
||
rm -rf model_store | ||
|
||
rm -rf logs | ||
} | ||
|
||
pip install mock pytest==3.6 pylint pytest-mock pytest-cov | ||
|
||
cd frontend | ||
|
||
if ./gradlew clean build; | ||
then | ||
echo "Frontend build suite execution successfully" | ||
else | ||
echo "Frontend build suite execution failed!!! Check logs for more details" | ||
exit 1 | ||
fi | ||
|
||
cd .. | ||
if python -m pytest --cov-report html:htmlcov --cov=ts/ ts/tests/unit_tests/; | ||
then | ||
echo "Backend test suite execution successfully" | ||
else | ||
echo "Backend test suite execution failed!!! Check logs for more details" | ||
exit 1 | ||
fi | ||
|
||
pip uninstall --yes torchserve | ||
pip uninstall --yes torch-model-archiver | ||
|
||
if pip install .; | ||
then | ||
echo "Successfully installed TorchServe" | ||
else | ||
echo "TorchServe installation failed" | ||
exit 1 | ||
fi | ||
|
||
cd model-archiver | ||
|
||
if python -m pytest --cov-report html:htmlcov --cov=model_archiver/ model_archiver/tests/unit_tests/; | ||
then | ||
echo "Model-archiver UT test suite execution successfully" | ||
else | ||
echo "Model-archiver UT test suite execution failed!!! Check logs for more details" | ||
exit 1 | ||
fi | ||
|
||
if pip install .; | ||
then | ||
echo "Successfully installed torch-model-archiver" | ||
else | ||
echo "torch-model-archiver installation failed" | ||
exit 1 | ||
fi | ||
|
||
if python -m pytest --cov-report html:htmlcov --cov=model_archiver/ model_archiver/tests/integ_tests/; | ||
then | ||
echo "Model-archiver IT test suite execution successful" | ||
else | ||
echo "Model-archiver IT test suite execution failed!!! Check logs for more details" | ||
exit 1 | ||
fi | ||
|
||
cd .. | ||
|
||
mkdir model_store | ||
|
||
echo "Starting TorchServe" | ||
torchserve --start --model-store model_store & | ||
pid=$! | ||
count=$(ps -A| grep $pid |wc -l) | ||
if [[ $count -eq 1 ]] | ||
then | ||
if wait $pid; then | ||
echo "Successfully started TorchServe" | ||
else | ||
echo "TorchServe start failed (returned $?)" | ||
exit 1 | ||
fi | ||
else | ||
echo "Successfully started TorchServe" | ||
fi | ||
|
||
sleep 10 | ||
|
||
echo "Registering resnet-18 model" | ||
response=$(curl --write-out %{http_code} --silent --output /dev/null --retry 5 -X POST "http://localhost:8081/models?url=https://torchserve.s3.amazonaws.com/mar_files/resnet-18.mar&initial_workers=1&synchronous=true") | ||
|
||
if [ ! "$response" == 200 ] | ||
then | ||
echo "Failed to register model with torchserve" | ||
cleanup | ||
exit 1 | ||
else | ||
echo "Successfully registered resnet-18 model with torchserve" | ||
fi | ||
|
||
echo "Running inference on resnet-18 model" | ||
response=$(curl --write-out %{http_code} --silent --output /dev/null --retry 5 -X POST http://localhost:8080/predictions/resnet-18 -T examples/image_classifier/kitten.jpg) | ||
|
||
if [ ! "$response" == 200 ] | ||
then | ||
echo "Failed to run inference on resnet-18 model" | ||
cleanup | ||
exit 1 | ||
else | ||
echo "Successfully ran infernece on resnet-18 model." | ||
fi | ||
|
||
cleanup | ||
|
||
echo "CONGRATULATIONS!!! YOUR BRANCH IS IN STABLE STATE" |