Skip to content

Commit c8b4554

Browse files
committed
review commit
1 parent 2f48789 commit c8b4554

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,24 @@ class ClientArguments(val args: Array[String], val sparkConf: SparkConf) {
4444

4545
parseArgs(args.toList)
4646

47-
files = Option(files).getOrElse(sparkConf.getOption("spark.yarn.dist.files").orNull)
48-
archives = Option(archives).getOrElse(sparkConf.getOption("spark.yarn.dist.archives").orNull)
47+
// -archives/--files via spark submit or yarn-client defaults to use file:// if not specified
48+
if (sys.props.contains("SPARK_SUBMIT") || (sparkConf.getOption("spark.master").isDefined &&
49+
sparkConf.get("spark.master") == "yarn-client")) {
50+
files = Option(files).map(p => Utils.resolveURIs(p)).orNull
51+
archives = Option(archives).map(p => Utils.resolveURIs(p)).orNull
52+
}
53+
54+
// env variable SPARK_YARN_DIST_ARCHIVES/SPARK_YARN_DIST_FILES set in yarn-client then
55+
// it should default to hdfs://
56+
files = Option(files).getOrElse(sys.props.get("SPARK_YARN_DIST_FILES").orNull)
57+
archives = Option(archives).getOrElse(sys.props.get("SPARK_YARN_DIST_ARCHIVES").orNull)
58+
59+
// spark.yarn.dist.archives/spark.yarn.dist.files defaults to use file:// if not specified,
60+
// for both yarn-client and yarn-cluster
61+
files = Option(files).getOrElse(sparkConf.getOption("spark.yarn.dist.files").
62+
map(p => Utils.resolveURIs(p)).orNull)
63+
archives = Option(archives).getOrElse(sparkConf.getOption("spark.yarn.dist.archives").
64+
map(p => Utils.resolveURIs(p)).orNull)
4965

5066
private def parseArgs(inputArgs: List[String]): Unit = {
5167
val userArgsBuffer: ArrayBuffer[String] = new ArrayBuffer[String]()

yarn/common/src/main/scala/org/apache/spark/scheduler/cluster/YarnClientSchedulerBackend.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ private[spark] class YarnClientSchedulerBackend(
7070
("--executor-cores", "SPARK_WORKER_CORES", "spark.executor.cores"),
7171
("--executor-cores", "SPARK_EXECUTOR_CORES", "spark.executor.cores"),
7272
("--queue", "SPARK_YARN_QUEUE", "spark.yarn.queue"),
73-
("--name", "SPARK_YARN_APP_NAME", "spark.app.name"),
74-
("--files", "SPARK_YARN_DIST_FILES", "spark.yarn.dist.files"),
75-
("--archives", "SPARK_YARN_DIST_ARCHIVES", "spark.yarn.dist.archives"))
73+
("--name", "SPARK_YARN_APP_NAME", "spark.app.name"))
7674
.foreach { case (optName, envVar, sysProp) => addArg(optName, envVar, sysProp, argsArrayBuf) }
7775

7876
logDebug("ClientArguments called with: " + argsArrayBuf)

0 commit comments

Comments
 (0)