You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fluo.apache.org by mw...@apache.org on 2017/10/31 17:44:17 UTC

[fluo] branch master updated: Fixes #957 Fluo scripts copy jars into fluo software dir. (#964)

This is an automated email from the ASF dual-hosted git repository.

mwalch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/fluo.git


The following commit(s) were added to refs/heads/master by this push:
     new d724855  Fixes #957 Fluo scripts copy jars into fluo software dir. (#964)
d724855 is described below

commit d724855a3ca23a0580dcf9f5e3e6b39b0431e8c2
Author: Manjiri Tapaswi <mp...@ncsu.edu>
AuthorDate: Tue Oct 31 10:44:16 2017 -0700

    Fixes #957 Fluo scripts copy jars into fluo software dir. (#964)
---
 modules/distribution/src/main/config/fluo-env.sh |  4 +++-
 modules/distribution/src/main/scripts/fluo       | 12 ++++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/modules/distribution/src/main/config/fluo-env.sh b/modules/distribution/src/main/config/fluo-env.sh
index e027f14..0b29665 100755
--- a/modules/distribution/src/main/config/fluo-env.sh
+++ b/modules/distribution/src/main/config/fluo-env.sh
@@ -14,7 +14,7 @@
 ## Before fluo-env.sh is loaded, these environment variables are set and can be used in this file:
 
 # cmd - Command that is being called such as oracle, worker, etc.
-# app - Fluo application name 
+# app - Fluo application name
 # basedir - Root of Fluo installation
 # conf - Directory containing Fluo configuration
 # lib - Directory containing Fluo libraries
@@ -27,6 +27,8 @@
 export HADOOP_PREFIX="${HADOOP_PREFIX:-/path/to/hadoop}"
 ## Fluo connection properties
 export FLUO_CONN_PROPS="${FLUO_CONN_PROPS:-${conf}/fluo-conn.properties}"
+## Fluo temp directory where the fluo script will copy jars from HDFS to the local machine
+export FLUO_TMP="${FLUO_TMP:-/tmp}"
 
 ####################################################
 # Build JAVA_OPTS variable used by all Fluo commands
diff --git a/modules/distribution/src/main/scripts/fluo b/modules/distribution/src/main/scripts/fluo
index abf5576..4116669 100755
--- a/modules/distribution/src/main/scripts/fluo
+++ b/modules/distribution/src/main/scripts/fluo
@@ -143,8 +143,10 @@ function setup_service {
     app=${BASH_REMATCH[1]}
     verify_app "$app"
     check_conn_props
-    app_lib=$lib/apps/$1
-    mkdir -p "$app_lib"
+    # create a temp dir to fetch application jars to
+    app_lib=$(mktemp -d "$FLUO_TMP"/fluo-"$app"-XXXXXXXXX) || die "fatal: unable to allocate a temporary directory"
+    # schedule removal of app_lib tmp dir when this script exits
+    trap "rm -rf '""$app_lib""'" EXIT HUP INT QUIT TERM
     $JAVA org.apache.fluo.command.FluoGetJars -d "$app_lib" "$@"
     export CLASSPATH="$conf:$app_lib/*:$CLASSPATH"
   else
@@ -225,8 +227,10 @@ exec)
     app=$2
     verify_app "$app"
     check_conn_props
-    app_lib=$lib/apps/$app
-    mkdir -p "$app_lib"
+    # create a temp dir to fetch application jars to
+    app_lib=$(mktemp -d "$FLUO_TMP"/fluo-"$app"-XXXXXXXXX) || die "fatal: unable to allocate a temporary directory"
+    # schedule removal of app_lib tmp dir when this script exits
+    trap "rm -rf '""$app_lib""'" EXIT HUP INT QUIT TERM
     $JAVA org.apache.fluo.command.FluoGetJars -d "$app_lib" -a "$app"
     export CLASSPATH="$conf:$app_lib/*:$CLASSPATH"
     $JAVA org.apache.fluo.command.FluoExec "${@:2}"

-- 
To stop receiving notification emails like this one, please contact
['"commits@fluo.apache.org" <co...@fluo.apache.org>'].