Skip to content

Commit 4ac9cac

Browse files
committed
SPARK-1652: spark-submit for yarn prints warnings even though calling as expected
1 parent 71f4d26 commit 4ac9cac

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ object SparkSubmit {
124124
}
125125
} else if (clusterManager == YARN) {
126126
childMainClass = "org.apache.spark.deploy.yarn.Client"
127+
// Special flag to avoid deprecation warnings at the client
128+
sysProps("SPARK_SUBMIT_YARN") = "true"
127129
childArgs += ("--jar", appArgs.primaryResource)
128130
childArgs += ("--class", appArgs.mainClass)
129131
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,10 @@ class Client(clientArgs: ClientArguments, hadoopConf: Configuration, spConf: Spa
169169
object Client {
170170

171171
def main(argStrings: Array[String]) {
172-
println("WARNING: This client is deprecated and will be removed in a future version of Spark.")
173-
println("Use ./bin/spark-submit with \"--master yarn\"")
172+
if (!sys.props.contains("SPARK_SUBMIT_YARN")) {
173+
println("WARNING: This client is deprecated and will be removed in a " +
174+
"future version of Spark. Use ./bin/spark-submit with \"--master yarn\"")
175+
}
174176

175177
// Set an env variable indicating we are running in YARN mode.
176178
// Note that anything with SPARK prefix gets propagated to all (remote) processes

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,10 @@ class Client(clientArgs: ClientArguments, hadoopConf: Configuration, spConf: Spa
171171
object Client {
172172

173173
def main(argStrings: Array[String]) {
174-
println("WARNING: This client is deprecated and will be removed in a future version of Spark.")
175-
println("Use ./bin/spark-submit with \"--master yarn\"")
174+
if (!sys.props.contains("SPARK_SUBMIT_YARN")) {
175+
println("WARNING: This client is deprecated and will be removed in a " +
176+
"future version of Spark. Use ./bin/spark-submit with \"--master yarn\"")
177+
}
176178

177179
// Set an env variable indicating we are running in YARN mode.
178180
// Note: anything env variable with SPARK_ prefix gets propagated to all (remote) processes -

0 commit comments

Comments
 (0)