Skip to content

Commit 2ab8551

Browse files
wangyumsrowen
authored andcommitted
[SPARK-18645][DEPLOY] Fix spark-daemon.sh arguments error lead to throws Unrecognized option
## What changes were proposed in this pull request? spark-daemon.sh will lost single quotes around after #15338. as follows: ``` execute_command nice -n 0 bash /opt/cloudera/parcels/SPARK-2.1.0-cdh5.4.3.d20161129-21.04.38/lib/spark/bin/spark-submit --class org.apache.spark.sql.hive.thriftserver.HiveThriftServer2 --name Thrift JDBC/ODBC Server --conf spark.driver.extraJavaOptions=-XX:+UseG1GC -XX:-HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp ``` With this fix, as follows: ``` execute_command nice -n 0 bash /opt/cloudera/parcels/SPARK-2.1.0-cdh5.4.3.d20161129-21.04.38/lib/spark/bin/spark-submit --class org.apache.spark.sql.hive.thriftserver.HiveThriftServer2 --name 'Thrift JDBC/ODBC Server' --conf 'spark.driver.extraJavaOptions=-XX:+UseG1GC -XX:-HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp' ``` ## How was this patch tested? - Manual tests - Build the package and start-thriftserver.sh with `--conf 'spark.driver.extraJavaOptions=-XX:+UseG1GC -XX:-HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp'` Author: Yuming Wang <[email protected]> Closes #16079 from wangyum/SPARK-18645.
1 parent dbf842b commit 2ab8551

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

sbin/spark-daemon.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,8 @@ if [ "$SPARK_NICENESS" = "" ]; then
124124
fi
125125

126126
execute_command() {
127-
local command="$@"
128127
if [ -z ${SPARK_NO_DAEMONIZE+set} ]; then
129-
nohup -- $command >> $log 2>&1 < /dev/null &
128+
nohup -- "$@" >> $log 2>&1 < /dev/null &
130129
newpid="$!"
131130

132131
echo "$newpid" > "$pid"
@@ -143,12 +142,12 @@ execute_command() {
143142
sleep 2
144143
# Check if the process has died; in that case we'll tail the log so the user can see
145144
if [[ ! $(ps -p "$newpid" -o comm=) =~ "java" ]]; then
146-
echo "failed to launch $command:"
145+
echo "failed to launch: $@"
147146
tail -2 "$log" | sed 's/^/ /'
148147
echo "full log in $log"
149148
fi
150149
else
151-
$command
150+
"$@"
152151
fi
153152
}
154153

@@ -176,11 +175,11 @@ run_command() {
176175

177176
case "$mode" in
178177
(class)
179-
execute_command nice -n "$SPARK_NICENESS" "${SPARK_HOME}"/bin/spark-class $command $@
178+
execute_command nice -n "$SPARK_NICENESS" "${SPARK_HOME}"/bin/spark-class "$command" "$@"
180179
;;
181180

182181
(submit)
183-
execute_command nice -n "$SPARK_NICENESS" bash "${SPARK_HOME}"/bin/spark-submit --class $command $@
182+
execute_command nice -n "$SPARK_NICENESS" bash "${SPARK_HOME}"/bin/spark-submit --class "$command" "$@"
184183
;;
185184

186185
(*)

0 commit comments

Comments
 (0)