Skip to content

Commit

Permalink
Use environment variable for model server home (#778)
Browse files Browse the repository at this point in the history
Change-Id: Ia59033bf35ab33553a5dc1289bbdc6a5bd879d72
  • Loading branch information
frankfliu authored Mar 24, 2021
1 parent 2152267 commit d075028
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion serving/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ startScripts {
defaultJvmOpts = []
doLast {
String text = unixScript.text.replace('exec "$JAVACMD" "$@"', 'exec env OMP_NUM_THREADS="1" MXNET_ENGINE_TYPE="NaiveEngine" TF_CPP_MIN_LOG_LEVEL=1 TF_NUM_INTRAOP_THREADS=1 "$JAVACMD" "$@"')
text = text.replace('DEFAULT_JVM_OPTS=""', 'DEFAULT_JVM_OPTS="-DMODEL_SERVER_HOME=${APP_HOME} -Dlog4j.configurationFile=${APP_HOME}/conf/log4j2.xml"')
text = text.replace('DEFAULT_JVM_OPTS=""', 'if [[ "${MODEL_SERVER_HOME}" = "" ]] ; then\n' +
' export MODEL_SERVER_HOME=${APP_HOME}\n' +
'fi\n' +
'DEFAULT_JVM_OPTS="-Dlog4j.configurationFile=${APP_HOME}/conf/log4j2.xml"\n')
unixScript.text = text
}
}
Expand Down
4 changes: 2 additions & 2 deletions serving/src/main/conf/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</Console>
<RollingFile
name="rollingFile"
fileName="${sys:MODEL_SERVER_HOME}/logs/serving.log"
filePattern="${sys:MODEL_SERVER_HOME}/logs/serving.%d{dd-MMM}.log.gz"
fileName="${env:MODEL_SERVER_HOME}/logs/serving.log"
filePattern="${env:MODEL_SERVER_HOME}/logs/serving.%d{dd-MMM}.log.gz"
ignoreExceptions="false">
<PatternLayout>
<Pattern>%d{yyyy-MM-dd HH:mm:ss} %-5p %m%n</Pattern>
Expand Down

0 comments on commit d075028

Please sign in to comment.