Skip to content

Commit 28a34b8

Browse files
committed
[SPARK-9672][MESOS] Don’t filter out MESOS_* when passing env vars
1 parent 7dd7972 commit 28a34b8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

core/src/main/scala/org/apache/spark/deploy/rest/RestSubmissionClient.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ private[spark] object RestSubmissionClient {
420420
* Filter non-spark environment variables from any environment.
421421
*/
422422
def filterSystemEnvironment(env: Map[String, String]): Map[String, String] = {
423-
val sparkVars = env.filter { case (k, _) => k.startsWith("SPARK_") }
423+
val sparkVars = env.filter { case (k, _) => k.startsWith("SPARK_") || k.startsWith("MESOS_") }
424424
sparkVars - "SPARK_ENV_LOADED"
425425
}
426426
}

core/src/test/scala/org/apache/spark/deploy/rest/StandaloneRestSubmitSuite.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,12 @@ class StandaloneRestSubmitSuite extends SparkFunSuite with BeforeAndAfterEach {
372372
assert(filteredVariables == Map("SPARK_VAR" -> "1"))
373373
}
374374

375+
test("client includes mesos env vars") {
376+
val environmentVariables = Map("SPARK_VAR" -> "1", "MESOS_VAR" -> "1", "OTHER_VAR" -> "1")
377+
val filteredVariables = RestSubmissionClient.filterSystemEnvironment(environmentVariables)
378+
assert(filteredVariables == Map("SPARK_VAR" -> "1", "MESOS_VAR" -> "1"))
379+
}
380+
375381
/* --------------------- *
376382
| Helper methods |
377383
* --------------------- */

0 commit comments

Comments
 (0)