Github user nchammas commented on a diff in the pull request:
https://github.com/apache/spark/pull/3881#discussion_r25227849
--- Diff: sbin/spark-daemon.sh ---
@@ -141,24 +151,36 @@ case $option in
rsync -a -e ssh --delete --exclude=.svn --exclude='logs/*'
--exclude='contrib/hod/logs/*' $SPARK_MASTER/ "$SPARK_HOME"
fi
- spark_rotate_log "$log"
- echo "starting $command, logging to $log"
- if [ $option == spark-submit ]; then
- source "$SPARK_HOME"/bin/utils.sh
- gatherSparkSubmitOpts "$@"
- nohup nice -n $SPARK_NICENESS "$SPARK_PREFIX"/bin/spark-submit
--class $command \
- "${SUBMISSION_OPTS[@]}" spark-internal "${APPLICATION_OPTS[@]}" >>
"$log" 2>&1 < /dev/null &
- else
- nohup nice -n $SPARK_NICENESS "$SPARK_PREFIX"/bin/spark-class
$command "$@" >> "$log" 2>&1 < /dev/null &
- fi
- newpid=$!
- echo $newpid > $pid
- sleep 2
- # Check if the process has died; in that case we'll tail the log so
the user can see
- if [[ ! $(ps -p "$newpid" -o args=) =~ $command ]]; then
- echo "failed to launch $command:"
- tail -2 "$log" | sed 's/^/ /'
- echo "full log in $log"
+ if [ "$RUN_IN_FOREGROUND" = "0" ]; then
+ spark_rotate_log "$log"
+ echo starting $command, logging to $log
+ if [ $option == spark-submit ]; then
+ source "$SPARK_HOME"/bin/utils.sh
+ gatherSparkSubmitOpts "$@"
+ nohup nice -n $SPARK_NICENESS "$SPARK_PREFIX"/bin/spark-submit
--class $command \
+ "${SUBMISSION_OPTS[@]}" spark-internal "${APPLICATION_OPTS[@]}"
>> "$log" 2>&1 < /dev/null &
+ else
+ nohup nice -n $SPARK_NICENESS "$SPARK_PREFIX"/bin/spark-class
$command "$@" >> "$log" 2>&1 < /dev/null &
+ fi
+ newpid=$!
+ echo $newpid > $pid
+ sleep 2
+ # Check if the process has died; in that case we'll tail the log so
the user can see
+ if ! kill -0 $newpid >/dev/null 2>&1; then
+ echo "failed to launch $command:"
+ tail -2 "$log" | sed 's/^/ /'
+ echo "full log in $log"
+ fi
+ else # run in foreground
+ echo starting $command, logging to stdout
+ if [ $option == spark-submit ]; then
+ source "$SPARK_HOME"/bin/utils.sh
+ gatherSparkSubmitOpts "$@"
+ nice -n $SPARK_NICENESS "$SPARK_PREFIX"/bin/spark-submit --class
$command \
--- End diff --
Same as above.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]