aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authortgravescs <tgraves@thatenemy-lm.champ.corp.yahoo.com>2013-10-03 11:52:16 -0500
committertgravescs <tgraves@thatenemy-lm.champ.corp.yahoo.com>2013-10-03 11:52:16 -0500
commit0fff4ee8523ff4137eedfc314b51135427137c63 (patch)
tree9f96cb33c2d5c3dc54b34a4716052957a1841633 /core
parent9d4246863a25f7c91f324e004fe000b9848f6057 (diff)
downloadspark-0fff4ee8523ff4137eedfc314b51135427137c63.tar.gz
spark-0fff4ee8523ff4137eedfc314b51135427137c63.tar.bz2
spark-0fff4ee8523ff4137eedfc314b51135427137c63.zip
Adding in the --addJars option to make SparkContext.addJar work on yarn and cleanup
the classpaths
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/SparkContext.scala17
1 files changed, 14 insertions, 3 deletions
diff --git a/core/src/main/scala/org/apache/spark/SparkContext.scala b/core/src/main/scala/org/apache/spark/SparkContext.scala
index 72540c712a..8ed5dcbf5d 100644
--- a/core/src/main/scala/org/apache/spark/SparkContext.scala
+++ b/core/src/main/scala/org/apache/spark/SparkContext.scala
@@ -643,10 +643,21 @@ class SparkContext(
key = uri.getScheme match {
case null | "file" =>
if (env.hadoop.isYarnMode()) {
- logWarning("local jar specified as parameter to addJar under Yarn mode")
- return
+ // In order for this to work on yarn the user must specify the --addjars option to
+ // the client to upload the file into the distributed cache to make it show up in the
+ // current working directory.
+ val fileName = new Path(uri.getPath).getName()
+ try {
+ env.httpFileServer.addJar(new File(fileName))
+ } catch {
+ case e: Exception => {
+ logError("Error adding jar (" + e + "), was the --addJars option used?")
+ throw e
+ }
+ }
+ } else {
+ env.httpFileServer.addJar(new File(uri.getPath))
}
- env.httpFileServer.addJar(new File(uri.getPath))
case _ =>
path
}