From bd2ab635a784ea031c52421587ffcfd0e7711267 Mon Sep 17 00:00:00 2001
From: Matei Zaharia <matei@eecs.berkeley.edu>
Date: Sat, 5 May 2012 20:05:15 -0700
Subject: [PATCH] Fixed the way the JAR server is created after finding issue
 at Twitter

---
 core/src/main/scala/spark/MesosScheduler.scala | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/core/src/main/scala/spark/MesosScheduler.scala b/core/src/main/scala/spark/MesosScheduler.scala
index 391e5f1714..dc58299a1d 100644
--- a/core/src/main/scala/spark/MesosScheduler.scala
+++ b/core/src/main/scala/spark/MesosScheduler.scala
@@ -99,11 +99,6 @@ private class MesosScheduler(
   }
   
   override def start() {
-    if (sc.jars.size > 0) {
-      // If the user added any JARS to the SparkContext, create an HTTP server
-      // to serve them to our executors
-      createJarServer()
-    }
     new Thread("Spark scheduler") {
       setDaemon(true)
       override def run {
@@ -125,7 +120,11 @@ private class MesosScheduler(
       case Some(path) => path
       case None =>
         throw new SparkException("Spark home is not set; set it through the spark.home system " +
-        		"property, the SPARK_HOME environment variable or the SparkContext constructor")
+            "property, the SPARK_HOME environment variable or the SparkContext constructor")
+    }
+    // If the user added JARs to the SparkContext, create an HTTP server to ship them to executors
+    if (sc.jars.size > 0) {
+      createJarServer()
     }
     val execScript = new File(sparkHome, "spark-executor").getCanonicalPath
     val environment = Environment.newBuilder()
-- 
GitLab