spark git commit: [SPARK-4832][Deploy]some other processes might take the daemon pid

2015-02-13 Thread srowen
Repository: spark
Updated Branches:
  refs/heads/branch-1.2 0ba065f0a -> 2b9dbddd3


[SPARK-4832][Deploy]some other processes might take the daemon pid

Some other processes might use the pid saved in pid file. In that case we 
should ignore it and launch daemons.

JIRA is down for maintenance. I will file one once it return.

Author: WangTaoTheTonic 
Author: WangTaoTheTonic 

Closes #3683 from WangTaoTheTonic/otherproc and squashes the following commits:

daa86a1 [WangTaoTheTonic] some bash style fix
8befee7 [WangTaoTheTonic] handle the mistake scenario
cf4ecc6 [WangTaoTheTonic] remove redundant condition
f36cfb4 [WangTaoTheTonic] some other processes might take the pid

(cherry picked from commit 1768bd51438670c493ca3ca02988aee3ae31e87e)
Signed-off-by: Sean Owen 


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/2b9dbddd
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/2b9dbddd
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/2b9dbddd

Branch: refs/heads/branch-1.2
Commit: 2b9dbddd3c7a98f9ca303ba43fdbac056da96417
Parents: 0ba065f
Author: WangTaoTheTonic 
Authored: Fri Feb 13 10:27:23 2015 +
Committer: Sean Owen 
Committed: Fri Feb 13 10:27:52 2015 +

--
 sbin/spark-daemon.sh | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/spark/blob/2b9dbddd/sbin/spark-daemon.sh
--
diff --git a/sbin/spark-daemon.sh b/sbin/spark-daemon.sh
index 89608bc..ec6d0b5 100755
--- a/sbin/spark-daemon.sh
+++ b/sbin/spark-daemon.sh
@@ -129,8 +129,9 @@ case $option in
 mkdir -p "$SPARK_PID_DIR"
 
 if [ -f $pid ]; then
-  if kill -0 `cat $pid` > /dev/null 2>&1; then
-echo $command running as process `cat $pid`.  Stop it first.
+  TARGET_ID="$(cat "$pid")"
+  if [[ $(ps -p "$TARGET_ID" -o args=) =~ $command ]]; then
+echo "$command running as process $TARGET_ID.  Stop it first."
 exit 1
   fi
 fi
@@ -141,7 +142,7 @@ case $option in
 fi
 
 spark_rotate_log "$log"
-echo starting $command, logging to $log
+echo "starting $command, logging to $log"
 if [ $option == spark-submit ]; then
   source "$SPARK_HOME"/bin/utils.sh
   gatherSparkSubmitOpts "$@"
@@ -154,7 +155,7 @@ case $option in
 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
+if [[ ! $(ps -p "$newpid" -o args=) =~ $command ]]; then
   echo "failed to launch $command:"
   tail -2 "$log" | sed 's/^/  /'
   echo "full log in $log"
@@ -164,14 +165,15 @@ case $option in
   (stop)
 
 if [ -f $pid ]; then
-  if kill -0 `cat $pid` > /dev/null 2>&1; then
-echo stopping $command
-kill `cat $pid`
+  TARGET_ID="$(cat "$pid")"
+  if [[ $(ps -p "$TARGET_ID" -o args=) =~ $command ]]; then
+echo "stopping $command"
+kill "$TARGET_ID"
   else
-echo no $command to stop
+echo "no $command to stop"
   fi
 else
-  echo no $command to stop
+  echo "no $command to stop"
 fi
 ;;
 


-
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org



spark git commit: [SPARK-4832][Deploy]some other processes might take the daemon pid

2015-02-13 Thread srowen
Repository: spark
Updated Branches:
  refs/heads/master 1c8633f3f -> 1768bd514


[SPARK-4832][Deploy]some other processes might take the daemon pid

Some other processes might use the pid saved in pid file. In that case we 
should ignore it and launch daemons.

JIRA is down for maintenance. I will file one once it return.

Author: WangTaoTheTonic 
Author: WangTaoTheTonic 

Closes #3683 from WangTaoTheTonic/otherproc and squashes the following commits:

daa86a1 [WangTaoTheTonic] some bash style fix
8befee7 [WangTaoTheTonic] handle the mistake scenario
cf4ecc6 [WangTaoTheTonic] remove redundant condition
f36cfb4 [WangTaoTheTonic] some other processes might take the pid


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/1768bd51
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/1768bd51
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/1768bd51

Branch: refs/heads/master
Commit: 1768bd51438670c493ca3ca02988aee3ae31e87e
Parents: 1c8633f
Author: WangTaoTheTonic 
Authored: Fri Feb 13 10:27:23 2015 +
Committer: Sean Owen 
Committed: Fri Feb 13 10:27:23 2015 +

--
 sbin/spark-daemon.sh | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/spark/blob/1768bd51/sbin/spark-daemon.sh
--
diff --git a/sbin/spark-daemon.sh b/sbin/spark-daemon.sh
index 89608bc..ec6d0b5 100755
--- a/sbin/spark-daemon.sh
+++ b/sbin/spark-daemon.sh
@@ -129,8 +129,9 @@ case $option in
 mkdir -p "$SPARK_PID_DIR"
 
 if [ -f $pid ]; then
-  if kill -0 `cat $pid` > /dev/null 2>&1; then
-echo $command running as process `cat $pid`.  Stop it first.
+  TARGET_ID="$(cat "$pid")"
+  if [[ $(ps -p "$TARGET_ID" -o args=) =~ $command ]]; then
+echo "$command running as process $TARGET_ID.  Stop it first."
 exit 1
   fi
 fi
@@ -141,7 +142,7 @@ case $option in
 fi
 
 spark_rotate_log "$log"
-echo starting $command, logging to $log
+echo "starting $command, logging to $log"
 if [ $option == spark-submit ]; then
   source "$SPARK_HOME"/bin/utils.sh
   gatherSparkSubmitOpts "$@"
@@ -154,7 +155,7 @@ case $option in
 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
+if [[ ! $(ps -p "$newpid" -o args=) =~ $command ]]; then
   echo "failed to launch $command:"
   tail -2 "$log" | sed 's/^/  /'
   echo "full log in $log"
@@ -164,14 +165,15 @@ case $option in
   (stop)
 
 if [ -f $pid ]; then
-  if kill -0 `cat $pid` > /dev/null 2>&1; then
-echo stopping $command
-kill `cat $pid`
+  TARGET_ID="$(cat "$pid")"
+  if [[ $(ps -p "$TARGET_ID" -o args=) =~ $command ]]; then
+echo "stopping $command"
+kill "$TARGET_ID"
   else
-echo no $command to stop
+echo "no $command to stop"
   fi
 else
-  echo no $command to stop
+  echo "no $command to stop"
 fi
 ;;
 


-
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org



spark git commit: [SPARK-4832][Deploy]some other processes might take the daemon pid

2015-02-13 Thread srowen
Repository: spark
Updated Branches:
  refs/heads/branch-1.3 a8f560c4e -> 1255e83f8


[SPARK-4832][Deploy]some other processes might take the daemon pid

Some other processes might use the pid saved in pid file. In that case we 
should ignore it and launch daemons.

JIRA is down for maintenance. I will file one once it return.

Author: WangTaoTheTonic 
Author: WangTaoTheTonic 

Closes #3683 from WangTaoTheTonic/otherproc and squashes the following commits:

daa86a1 [WangTaoTheTonic] some bash style fix
8befee7 [WangTaoTheTonic] handle the mistake scenario
cf4ecc6 [WangTaoTheTonic] remove redundant condition
f36cfb4 [WangTaoTheTonic] some other processes might take the pid

(cherry picked from commit 1768bd51438670c493ca3ca02988aee3ae31e87e)
Signed-off-by: Sean Owen 


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/1255e83f
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/1255e83f
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/1255e83f

Branch: refs/heads/branch-1.3
Commit: 1255e83f841b59fd3c52fff3e6a733b8132c8d30
Parents: a8f560c
Author: WangTaoTheTonic 
Authored: Fri Feb 13 10:27:23 2015 +
Committer: Sean Owen 
Committed: Fri Feb 13 10:27:34 2015 +

--
 sbin/spark-daemon.sh | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/spark/blob/1255e83f/sbin/spark-daemon.sh
--
diff --git a/sbin/spark-daemon.sh b/sbin/spark-daemon.sh
index 89608bc..ec6d0b5 100755
--- a/sbin/spark-daemon.sh
+++ b/sbin/spark-daemon.sh
@@ -129,8 +129,9 @@ case $option in
 mkdir -p "$SPARK_PID_DIR"
 
 if [ -f $pid ]; then
-  if kill -0 `cat $pid` > /dev/null 2>&1; then
-echo $command running as process `cat $pid`.  Stop it first.
+  TARGET_ID="$(cat "$pid")"
+  if [[ $(ps -p "$TARGET_ID" -o args=) =~ $command ]]; then
+echo "$command running as process $TARGET_ID.  Stop it first."
 exit 1
   fi
 fi
@@ -141,7 +142,7 @@ case $option in
 fi
 
 spark_rotate_log "$log"
-echo starting $command, logging to $log
+echo "starting $command, logging to $log"
 if [ $option == spark-submit ]; then
   source "$SPARK_HOME"/bin/utils.sh
   gatherSparkSubmitOpts "$@"
@@ -154,7 +155,7 @@ case $option in
 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
+if [[ ! $(ps -p "$newpid" -o args=) =~ $command ]]; then
   echo "failed to launch $command:"
   tail -2 "$log" | sed 's/^/  /'
   echo "full log in $log"
@@ -164,14 +165,15 @@ case $option in
   (stop)
 
 if [ -f $pid ]; then
-  if kill -0 `cat $pid` > /dev/null 2>&1; then
-echo stopping $command
-kill `cat $pid`
+  TARGET_ID="$(cat "$pid")"
+  if [[ $(ps -p "$TARGET_ID" -o args=) =~ $command ]]; then
+echo "stopping $command"
+kill "$TARGET_ID"
   else
-echo no $command to stop
+echo "no $command to stop"
   fi
 else
-  echo no $command to stop
+  echo "no $command to stop"
 fi
 ;;
 


-
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org