diff options
author | jerryshao <sshao@hortonworks.com> | 2015-11-04 10:49:34 +0000 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2015-11-04 10:49:34 +0000 |
commit | 8aff36e91de0fee2f3f56c6d240bb203b5bb48ba (patch) | |
tree | 0afdded361cb75e7658053953abfdb484da78ced /sbin/stop-slave.sh | |
parent | 2692bdb7dbf36d6247f595d5fd0cb9cda89e1fdd (diff) | |
download | spark-8aff36e91de0fee2f3f56c6d240bb203b5bb48ba.tar.gz spark-8aff36e91de0fee2f3f56c6d240bb203b5bb48ba.tar.bz2 spark-8aff36e91de0fee2f3f56c6d240bb203b5bb48ba.zip |
[SPARK-2960][DEPLOY] Support executing Spark from symlinks (reopen)
This PR is based on the work of roji to support running Spark scripts from symlinks. Thanks for the great work roji . Would you mind taking a look at this PR, thanks a lot.
For releases like HDP and others, normally it will expose the Spark executables as symlinks and put in `PATH`, but current Spark's scripts do not support finding real path from symlink recursively, this will make spark fail to execute from symlink. This PR try to solve this issue by finding the absolute path from symlink.
Instead of using `readlink -f` like what this PR (https://github.com/apache/spark/pull/2386) implemented is that `-f` is not support for Mac, so here manually seeking the path through loop.
I've tested with Mac and Linux (Cent OS), looks fine.
This PR did not fix the scripts under `sbin` folder, not sure if it needs to be fixed also?
Please help to review, any comment is greatly appreciated.
Author: jerryshao <sshao@hortonworks.com>
Author: Shay Rojansky <roji@roji.org>
Closes #8669 from jerryshao/SPARK-2960.
Diffstat (limited to 'sbin/stop-slave.sh')
-rwxr-xr-x | sbin/stop-slave.sh | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sbin/stop-slave.sh b/sbin/stop-slave.sh index 3d1da5b254..685bcf59b3 100755 --- a/sbin/stop-slave.sh +++ b/sbin/stop-slave.sh @@ -21,23 +21,24 @@ # # Environment variables # -# SPARK_WORKER_INSTANCES The number of worker instances that should be +# SPARK_WORKER_INSTANCES The number of worker instances that should be # running on this slave. Default is 1. # Usage: stop-slave.sh # Stops all slaves on this worker machine -sbin="`dirname "$0"`" -sbin="`cd "$sbin"; pwd`" +if [ -z "${SPARK_HOME}" ]; then + export SPARK_HOME="$(cd "`dirname "$0"`"/..; pwd)" +fi -. "$sbin/spark-config.sh" +. "${SPARK_HOME}/sbin/spark-config.sh" -. "$SPARK_PREFIX/bin/load-spark-env.sh" +. "${SPARK_HOME}/bin/load-spark-env.sh" if [ "$SPARK_WORKER_INSTANCES" = "" ]; then - "$sbin"/spark-daemon.sh stop org.apache.spark.deploy.worker.Worker 1 + "${SPARK_HOME}/sbin"/spark-daemon.sh stop org.apache.spark.deploy.worker.Worker 1 else for ((i=0; i<$SPARK_WORKER_INSTANCES; i++)); do - "$sbin"/spark-daemon.sh stop org.apache.spark.deploy.worker.Worker $(( $i + 1 )) + "${SPARK_HOME}/sbin"/spark-daemon.sh stop org.apache.spark.deploy.worker.Worker $(( $i + 1 )) done fi |