From fd4bd8a8e3125f7f0f5b2845b6f0f12795731c09 Mon Sep 17 00:00:00 2001 From: Egor Pakhomov Date: Wed, 5 Mar 2014 13:14:09 +0400 Subject: [PATCH] Allow SPARK_JAR to be set in system properties --- .../scala/org/apache/spark/deploy/yarn/ClientBase.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yarn/common/src/main/scala/org/apache/spark/deploy/yarn/ClientBase.scala b/yarn/common/src/main/scala/org/apache/spark/deploy/yarn/ClientBase.scala index 4b6c7db836b02..01bc0056be790 100644 --- a/yarn/common/src/main/scala/org/apache/spark/deploy/yarn/ClientBase.scala +++ b/yarn/common/src/main/scala/org/apache/spark/deploy/yarn/ClientBase.scala @@ -67,7 +67,7 @@ trait ClientBase extends Logging { // TODO(harvey): This could just go in ClientArguments. def validateArgs() = { Map( - (System.getenv("SPARK_JAR") == null) -> "Error: You must set SPARK_JAR environment variable!", + ((System.getenv("SPARK_JAR") == null) && (System.getProperty("SPARK_JAR") == null)) -> "Error: You must set SPARK_JAR environment variable!", ((args.userJar == null && args.amClass == classOf[ApplicationMaster].getName) -> "Error: You must specify a user jar when running in standalone mode!"), (args.userClass == null) -> "Error: You must specify a user class!", @@ -205,8 +205,12 @@ trait ClientBase extends Logging { val statCache: Map[URI, FileStatus] = HashMap[URI, FileStatus]() + val sparkJar = System.getenv("SPARK_JAR") match { + case null => System.getProperty("SPARK_JAR") + case s: String => s + } Map( - ClientBase.SPARK_JAR -> System.getenv("SPARK_JAR"), ClientBase.APP_JAR -> args.userJar, + ClientBase.SPARK_JAR -> sparkJar, ClientBase.APP_JAR -> args.userJar, ClientBase.LOG4J_PROP -> System.getenv("SPARK_LOG4J_CONF") ).foreach { case(destName, _localPath) => val localPath: String = if (_localPath != null) _localPath.trim() else ""