Skip to content
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

test build if mar files exist. #7

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ USER modelscoring
WORKDIR /home/modelscoring/
ADD $MODEL_SCORING_PACKAGE .

EXPOSE 9100

WORKDIR /home/modelscoring/
ENTRYPOINT [ "bin/model-scoring.sh" ]

51 changes: 49 additions & 2 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ echo Base name $NAME
NAME=${NAME//.zip/}
echo Base name $NAME

echo docker build --file=Dockerfile --tag=scoring-engine \
echo docker build --file=Dockerfile --tag=scoring-engine-$BUILD_NUMBER \
--build-arg HTTP_PROXY=$http_proxy \
--build-arg HTTPS_PROXY=$http_proxy \
--build-arg NO_PROXY=$no_proxy \
Expand All @@ -46,7 +46,7 @@ echo docker build --file=Dockerfile --tag=scoring-engine \
--build-arg no_proxy=$no_proxy \
--build-arg MODEL_SCORING_PACKAGE=$NAME \
.
docker build --file=Dockerfile --tag=scoring-engine \
docker build --file=Dockerfile --tag=scoring-engine-$BUILD_NUMBER \
--build-arg HTTP_PROXY=$http_proxy \
--build-arg HTTPS_PROXY=$http_proxy \
--build-arg NO_PROXY=$no_proxy \
Expand All @@ -56,3 +56,50 @@ docker build --file=Dockerfile --tag=scoring-engine \
--build-arg MODEL_SCORING_PACKAGE=$NAME \
.

mars=$(find `pwd` -name "*.mar" -type f )
IFS=$'\n'
for mar in $mars
do
echo
echo $mar
MARNAME="`basename $mar`"
echo Base name $MARNAME
MARNAME=${MARNAME//.mar/}
echo Base name $MARNAME
docker kill $MARNAME-$BUILD_NUMBER
docker rm $MARNAME-$BUILD_NUMBER
done

for mar in $mars
do
echo
echo $mar
MARNAME="`basename $mar`"
echo Base name $MARNAME
MARNAME=${MARNAME//.mar/}
echo Base name $MARNAME
DOCKERCONT=$MARNAME-$BUILD_NUMBER
docker kill $DOCKERCONT
docker rm $DOCKERCONT
docker run -it -d -p 9100:9100 --name=$DOCKERCONT scoring-engine-$BUILD_NUMBER
MAX=20
code=$(curl -s -o /dev/null localhost:9100 -w "%{http_code}")
count=$((0))
while [ $code -ne 200 ] && [ $count -lt $MAX ];
do
echo $code
code=$(curl -s -o /dev/null localhost:9100 -w "%{http_code}")
count=$((0+1))
sleep 1
done
code=$(curl -F "file=@$mar" -s -o /dev/null localhost:9100/uploadMarFile -w "%{http_code}")
if [ $code -ge 200 ] && [ $code -lt 400 ]; then
echo yes $code
else
echo failed to load model $mar, http status code $code
docker logs $DOCKERCONT
exit 1
fi
docker kill $DOCKERCONT
docker rm $DOCKERCONT
done
3 changes: 0 additions & 3 deletions model-scoring-core/bin/model-scoring.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ export HOSTNAME=`hostname`
# It is difficult to modify the library path for dynamic libraries after the Java process has started
# LD_LIBRARY_PATH allows the OS to find the dynamic libraries and any dependencies
export MODEL_TMP_DIR=`mktemp -d -t tap-scoring-modelXXXXXXXXXXXXXXXXXX`


export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MODEL_TMP_DIR


MODEL_SCORING_MAIN="org.trustedanalytics.scoring.MyMainFunction"


Expand Down
2 changes: 1 addition & 1 deletion model-scoring-core/bin/scoring-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
# limitations under the License.
#

#set -o errexit
DIR="$( cd "$( dirname "$0" )" && pwd )"

pushd $DIR/..

pwd

export HOSTNAME=`hostname`
Expand Down
2 changes: 1 addition & 1 deletion model-scoring-core/conf/application.conf.scoring
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#The mar file path can be provided on the command line with a java property
#-Dtrustedanalytics.scoring-engine.archive-mar="SOME_PATH"
trustedanalytics.scoring-engine {
archive-mar = "hdfs://SOME_PATH/SOME_TAR"
archive-mar = ""
}

#-Dtrustedanalytics.scoring.port="SOME_PORT"
Expand Down
3 changes: 0 additions & 3 deletions model-scoring-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@
<version>1.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>default-compile</id>
Expand Down Expand Up @@ -258,11 +260,9 @@
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>3.6.0</version>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
Expand Down