apache/spark — pull request #1331 by CodingCat (2014-07-08 17:27:31+00:00)
Title: SPARK-2404: don't overwrite SPARK_HOME when it is set

In spark-class and spark-submit, the SPARK_HOME is set to the present working directory, causing the value of already defined SPARK_HOME being overwritten

We should not overwrite that if SPARK_HOME has been defined

Our scenario:

We have a login portal for all the team members to use the spark-cluster, everyone gets an account and home directory. Spark-1.0 is copied in the root path "/", every account gets a software link to the /spark-1.0 in it's home directory.

Spark 1.0 is deployed in a cluster, where the user name is different with any accounts except one, say "CodingCat", we set a global SPARK_HOME to /home/CodingCat/spark-1.0 which is consistent with the remote cluster setup, but unfortunately, this is overwritten by the spark-class and spark-submit ....so in login portal, when the user runs spark-shell, it always tries to run /home/user_account/spark-1.0/bin/compute-class.sh, which does not exist.