Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3881#discussion_r25224323
  
    --- Diff: sbin/spark-daemon.sh ---
    @@ -140,24 +150,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 &
    +    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
    --- End diff --
    
    Minor coding style thing, but could we add explicit comments to the `else` 
branches to help reiterate what case it corresponds to?   With the deep nesting 
of `else` statements here, it's a little easy to get lost and not spot that 
this one refers to the "run in background / daemonize" case.  So, maybe just 
write something like
    
    ```bash
    else # run in background
    ```
    
    would help.


---
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]

Reply via email to