Skip to content

Commit 8362489

Browse files
committed
yarn.ClientBase spark.yarn.dist.* do not work
1 parent b8d2580 commit 8362489

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

yarn/common/src/main/scala/org/apache/spark/deploy/yarn/ClientBase.scala

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,21 @@ trait ClientBase extends Logging {
220220
}
221221
}
222222

223+
def getArg(arg: String, envVar: String, sysProp: String): String = {
224+
if (arg != null && !arg.isEmpty) {
225+
arg
226+
} else if (System.getenv(envVar) != null && !System.getenv(envVar).isEmpty) {
227+
System.getenv(envVar)
228+
} else {
229+
sparkConf.getOption(sysProp).orNull
230+
}
231+
}
223232
var cachedSecondaryJarLinks = ListBuffer.empty[String]
224-
val fileLists = List( (args.addJars, LocalResourceType.FILE, true),
225-
(args.files, LocalResourceType.FILE, false),
226-
(args.archives, LocalResourceType.ARCHIVE, false) )
233+
val fileLists = List((args.addJars, LocalResourceType.FILE, true),
234+
(getArg(args.files, "SPARK_YARN_DIST_FILES", "spark.yarn.dist.files"),
235+
LocalResourceType.FILE, false),
236+
(getArg(args.archives, "SPARK_YARN_DIST_ARCHIVES", "spark.yarn.dist.archives"),
237+
LocalResourceType.ARCHIVE, false))
227238
fileLists.foreach { case (flist, resType, addToClasspath) =>
228239
if (flist != null && !flist.isEmpty()) {
229240
flist.split(',').foreach { case file: String =>

0 commit comments

Comments
 (0)