You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by vi...@apache.org on 2019/11/25 21:25:52 UTC

[incubator-hudi] branch master updated: [HUDI-359] Add hudi-env for hudi-cli module (#1042)

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

vinoth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new a7e07cd  [HUDI-359] Add hudi-env for hudi-cli module (#1042)
a7e07cd is described below

commit a7e07cd910425b5cfe9886677e780bfb2ae96c52
Author: hongdd <jn...@163.com>
AuthorDate: Tue Nov 26 05:25:42 2019 +0800

    [HUDI-359] Add hudi-env for hudi-cli module (#1042)
---
 hudi-cli/{hudi-cli.sh => conf/hudi-env.sh} | 18 ++++--------------
 hudi-cli/hudi-cli.sh                       | 14 +++++---------
 2 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/hudi-cli/hudi-cli.sh b/hudi-cli/conf/hudi-env.sh
old mode 100755
new mode 100644
similarity index 61%
copy from hudi-cli/hudi-cli.sh
copy to hudi-cli/conf/hudi-env.sh
index a0b242a..0499502
--- a/hudi-cli/hudi-cli.sh
+++ b/hudi-cli/conf/hudi-env.sh
@@ -18,17 +18,7 @@
 # limitations under the License.
 ################################################################################
 
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-HOODIE_JAR=`ls $DIR/target/hudi-cli-*.jar | grep -v source | grep -v javadoc`
-if [ -z "$HADOOP_CONF_DIR" ]; then
-  echo "setting hadoop conf dir"
-  HADOOP_CONF_DIR="/etc/hadoop/conf"
-fi
-if [ -z "$SPARK_CONF_DIR" ]; then
-  echo "setting spark conf dir"
-  SPARK_CONF_DIR="/etc/spark/conf"
-fi
-if [ -z "$CLIENT_JAR" ]; then
-  echo "client jar location not set"
-fi
-java -cp ${HADOOP_CONF_DIR}:${SPARK_CONF_DIR}:$DIR/target/lib/*:$HOODIE_JAR:${CLIENT_JAR} -DSPARK_CONF_DIR=${SPARK_CONF_DIR} -DHADOOP_CONF_DIR=${HADOOP_CONF_DIR} org.springframework.shell.Bootstrap $@
+# Set the necessary environment variables
+export HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-"/etc/hadoop/conf"}
+export SPARK_CONF_DIR=${SPARK_CONF_DIR:-"/etc/spark/conf"}
+export CLIENT_JAR=${CLIENT_JAR}
diff --git a/hudi-cli/hudi-cli.sh b/hudi-cli/hudi-cli.sh
index a0b242a..3ab0096 100755
--- a/hudi-cli/hudi-cli.sh
+++ b/hudi-cli/hudi-cli.sh
@@ -20,15 +20,11 @@
 
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 HOODIE_JAR=`ls $DIR/target/hudi-cli-*.jar | grep -v source | grep -v javadoc`
-if [ -z "$HADOOP_CONF_DIR" ]; then
-  echo "setting hadoop conf dir"
-  HADOOP_CONF_DIR="/etc/hadoop/conf"
-fi
-if [ -z "$SPARK_CONF_DIR" ]; then
-  echo "setting spark conf dir"
-  SPARK_CONF_DIR="/etc/spark/conf"
-fi
+
+. "${DIR}"/conf/hudi-env.sh
+
 if [ -z "$CLIENT_JAR" ]; then
-  echo "client jar location not set"
+  echo "Client jar location not set, please set it in conf/hudi-env.sh"
 fi
+
 java -cp ${HADOOP_CONF_DIR}:${SPARK_CONF_DIR}:$DIR/target/lib/*:$HOODIE_JAR:${CLIENT_JAR} -DSPARK_CONF_DIR=${SPARK_CONF_DIR} -DHADOOP_CONF_DIR=${HADOOP_CONF_DIR} org.springframework.shell.Bootstrap $@