diff options
author | Reynold Xin <rxin@apache.org> | 2014-01-05 19:25:09 -0800 |
---|---|---|
committer | Reynold Xin <rxin@apache.org> | 2014-01-05 19:25:09 -0800 |
commit | 5b0986a1d675f0f9d7d14b3d48fdadcb4f7055b7 (patch) | |
tree | 76adbc116b690647a42372633e2b501e4fa8bec0 /core/src | |
parent | f4b924f6623525d0f9287039b963fd5f7eaf1a7d (diff) | |
parent | 79f52809c836d08023aa5ca99a467d3a311a7359 (diff) | |
download | spark-5b0986a1d675f0f9d7d14b3d48fdadcb4f7055b7.tar.gz spark-5b0986a1d675f0f9d7d14b3d48fdadcb4f7055b7.tar.bz2 spark-5b0986a1d675f0f9d7d14b3d48fdadcb4f7055b7.zip |
Merge pull request #334 from pwendell/examples-fix
Removing SPARK_EXAMPLES_JAR in the code
This re-writes all of the examples to use the `SparkContext.jarOfClass` mechanism for loading the examples jar. This necessary for environments like YARN and the Standalone mode where example programs will be submit from inside the cluster rather than at the client using `./spark-example`.
This still leaves SPARK_EXAMPLES_JAR in place in the shell scripts for setting up the classpath if `./spark-example` is run.
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/scala/org/apache/spark/api/java/JavaSparkContext.scala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/src/main/scala/org/apache/spark/api/java/JavaSparkContext.scala b/core/src/main/scala/org/apache/spark/api/java/JavaSparkContext.scala index 5be5317f40..e93b10fd7e 100644 --- a/core/src/main/scala/org/apache/spark/api/java/JavaSparkContext.scala +++ b/core/src/main/scala/org/apache/spark/api/java/JavaSparkContext.scala @@ -431,4 +431,10 @@ object JavaSparkContext { implicit def fromSparkContext(sc: SparkContext): JavaSparkContext = new JavaSparkContext(sc) implicit def toSparkContext(jsc: JavaSparkContext): SparkContext = jsc.sc + + /** + * Find the JAR from which a given class was loaded, to make it easy for users to pass + * their JARs to SparkContext. + */ + def jarOfClass(cls: Class[_]) = SparkContext.jarOfClass(cls).toArray } |