From e5df0665c654e76ef43c846f22bee3ec7a9a99bf Mon Sep 17 00:00:00 2001 From: kunni Date: Wed, 13 Jul 2022 16:29:16 +0800 Subject: [PATCH] [hotfix-#1043][bin] allow user to submit job in local mode while remaining empty environment config of FLINK_HOME and HADOOP_HOME and fix bug in standalone mode that parameters were not tranfered. --- bin/chunjun-standalone.sh | 2 +- bin/submit.sh | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/bin/chunjun-standalone.sh b/bin/chunjun-standalone.sh index 60e11fc590..58554b6360 100644 --- a/bin/chunjun-standalone.sh +++ b/bin/chunjun-standalone.sh @@ -40,4 +40,4 @@ done bin=`dirname "$target"` # get flink config -. "$bin"/submit.sh +. "$bin"/submit.sh $@ diff --git a/bin/submit.sh b/bin/submit.sh index 9423ea3fc8..e85cb72817 100644 --- a/bin/submit.sh +++ b/bin/submit.sh @@ -58,4 +58,19 @@ echo "FLINK_HOME is $FLINK_HOME" echo "HADOOP_HOME is $HADOOP_HOME" echo "ChunJun starting ..." -$JAVA_RUN -cp $JAR_DIR $CLASS_NAME $ARGS -mode $MODE -jobType $JOBTYPE -chunjunDistDir $CHUNJUN_HOME -flinkConfDir $FLINK_HOME/conf -flinkLibDir $FLINK_HOME/lib -hadoopConfDir $HADOOP_HOME/etc/hadoop +# basic parameters for all jobs +PARAMS="$ARGS -mode $MODE -jobType $JOBTYPE -chunjunDistDir $CHUNJUN_HOME" + +# if FLINK_HOME is not set or not a directory, ignore flinkConfDir parameter +if [ ! -z $FLINK_HOME ] && [ -d $FLINK_HOME ];then + PARAMS="$PARAMS -flinkConfDir $FLINK_HOME/conf -flinkLibDir $FLINK_HOME/lib" +fi + +# if HADOOP_HOME is not set or not a directory, ignore hadoopConfDir parameter +if [ ! -z $HADOOP_HOME ] && [ -d $HADOOP_HOME ];then + PARAMS="$PARAMS -hadoopConfDir $HADOOP_HOME/etc/hadoop" +fi + +echo "start command: $JAVA_RUN -cp $JAR_DIR $CLASS_NAME $PARAMS" + +$JAVA_RUN -cp $JAR_DIR $CLASS_NAME $PARAMS