Skip to content

Commit c63f31f

Browse files
committed
Update
1 parent 547fd95 commit c63f31f

File tree

1 file changed

+12
-2
lines changed
  • yarn/src/main/scala/org/apache/spark/deploy/yarn

1 file changed

+12
-2
lines changed

yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.apache.spark.deploy.yarn
1919

20+
import java.io.File
2021
import java.net.{InetAddress, UnknownHostException, URI, URISyntaxException}
2122
import java.nio.ByteBuffer
2223

@@ -752,8 +753,17 @@ object Client extends Logging {
752753
if (conf.contains(CONF_PYSPARK_ARCHIVES)) {
753754
conf.get(CONF_PYSPARK_ARCHIVES)
754755
} else {
755-
val sparkJarPath = SparkContext.jarOfClass(this.getClass).head
756-
sparkJarPath.substring(0, sparkJarPath.lastIndexOf('/')) + "/pyspark.zip"
756+
SparkContext.jarOfClass(this.getClass) match {
757+
case Some(jarPath) =>
758+
val path = new File(jarPath)
759+
val archives = new File(path.getParent + File.separator + "pyspark.zip")
760+
if (archives.exists()) {
761+
archives.getAbsolutePath
762+
} else {
763+
""
764+
}
765+
case None => ""
766+
}
757767
}
758768
}
759769

0 commit comments

Comments
 (0)