Skip to content

Commit 9f7a095

Browse files
committed
SPARK-1652: Remove incorrect deprecation warning in spark-submit
This is a straightforward fix. Author: Patrick Wendell <[email protected]> This patch had conflicts when merged, resolved by Committer: Patrick Wendell <[email protected]> Closes #578 from pwendell/spark-submit-yarn and squashes the following commits: 96027c7 [Patrick Wendell] Test fixes b5be173 [Patrick Wendell] Review feedback 4ac9cac [Patrick Wendell] SPARK-1652: spark-submit for yarn prints warnings even though calling as expected
1 parent 949e393 commit 9f7a095

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ object SparkSubmit {
137137
throw new Exception(msg)
138138
}
139139
}
140+
141+
// Special flag to avoid deprecation warnings at the client
142+
sysProps("SPARK_SUBMIT") = "true"
140143

141144
val options = List[OptionAssigner](
142145
new OptionAssigner(appArgs.master, ALL_CLUSTER_MGRS, false, sysProp = "spark.master"),

core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class SparkSubmitSuite extends FunSuite with ShouldMatchers {
122122
childArgsStr should include ("--num-executors 6")
123123
mainClass should be ("org.apache.spark.deploy.yarn.Client")
124124
classpath should have length (0)
125-
sysProps should have size (0)
125+
sysProps should have size (1)
126126
}
127127

128128
test("handles YARN client mode") {
@@ -146,6 +146,7 @@ class SparkSubmitSuite extends FunSuite with ShouldMatchers {
146146
sysProps("spark.yarn.dist.files") should be ("file1.txt,file2.txt")
147147
sysProps("spark.yarn.dist.archives") should be ("archive1.txt,archive2.txt")
148148
sysProps("spark.executor.instances") should be ("6")
149+
sysProps("SPARK_SUBMIT") should be ("true")
149150
}
150151

151152
test("handles standalone cluster mode") {
@@ -159,7 +160,7 @@ class SparkSubmitSuite extends FunSuite with ShouldMatchers {
159160
childArgsStr should include ("launch spark://h:p thejar.jar org.SomeClass arg1 arg2")
160161
mainClass should be ("org.apache.spark.deploy.Client")
161162
classpath should have length (0)
162-
sysProps should have size (1) // contains --jar entry
163+
sysProps should have size (2) // contains --jar entry and SPARK_SUBMIT
163164
}
164165

165166
test("handles standalone client mode") {

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")) {
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")) {
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)