Skip to content

Commit 792d908

Browse files
committed
Merge pull request apache#470 from tgravescs/fix_spark_examples_yarn
Only log error on missing jar to allow spark examples to jar. Right now to run the spark examples on Yarn you have to use the --addJars option and put the jar in hdfs. To make that nicer so the user doesn't have to specify the --addJars option change it to simply log an error instead of throwing.
2 parents 256a355 + dd56b21 commit 792d908

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

core/src/main/scala/org/apache/spark/SparkContext.scala

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -708,8 +708,11 @@ class SparkContext(
708708
env.httpFileServer.addJar(new File(fileName))
709709
} catch {
710710
case e: Exception => {
711+
// For now just log an error but allow to go through so spark examples work.
712+
// The spark examples don't really need the jar distributed since its also
713+
// the app jar.
711714
logError("Error adding jar (" + e + "), was the --addJars option used?")
712-
throw e
715+
null
713716
}
714717
}
715718
} else {
@@ -722,8 +725,10 @@ class SparkContext(
722725
path
723726
}
724727
}
725-
addedJars(key) = System.currentTimeMillis
726-
logInfo("Added JAR " + path + " at " + key + " with timestamp " + addedJars(key))
728+
if (key != null) {
729+
addedJars(key) = System.currentTimeMillis
730+
logInfo("Added JAR " + path + " at " + key + " with timestamp " + addedJars(key))
731+
}
727732
}
728733
}
729734

0 commit comments

Comments
 (0)