Skip to content
This repository was archived by the owner on Jan 9, 2020. It is now read-only.

Commit faa2849

Browse files
committed
Rebased on master and added a constant val for the Client class
1 parent c35fe48 commit faa2849

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ object SparkSubmit extends CommandLineUtils with Logging {
9898
"org.apache.spark.deploy.yarn.YarnClusterApplication"
9999
private[deploy] val REST_CLUSTER_SUBMIT_CLASS = classOf[RestSubmissionClientApp].getName()
100100
private[deploy] val STANDALONE_CLUSTER_SUBMIT_CLASS = classOf[ClientApp].getName()
101+
private[deploy] val KUBERNETES_CLUSTER_SUBMIT_CLASS = "org.apache.spark.deploy.k8s.submit.Client"
101102

102103
// scalastyle:off println
103104
private[spark] def printVersionAndExit(): Unit = {
@@ -298,6 +299,12 @@ object SparkSubmit extends CommandLineUtils with Logging {
298299

299300
if (clusterManager == KUBERNETES) {
300301
args.master = Utils.checkAndGetK8sMasterUrl(args.master)
302+
// Make sure YARN is included in our build if we're trying to use it
303+
if (!Utils.classIsLoadable(KUBERNETES_CLUSTER_SUBMIT_CLASS) && !Utils.isTesting) {
304+
printErrorAndExit(
305+
"Could not load KUBERNETES classes. " +
306+
"This copy of Spark may not have been compiled with KUBERNETES support.")
307+
}
301308
}
302309

303310
// Fail fast, the following modes are not supported or applicable
@@ -721,7 +728,7 @@ object SparkSubmit extends CommandLineUtils with Logging {
721728
}
722729

723730
if (isKubernetesCluster) {
724-
childMainClass = "org.apache.spark.deploy.k8s.submit.Client"
731+
childMainClass = KUBERNETES_CLUSTER_SUBMIT_CLASS
725732
if (args.primaryResource != SparkLauncher.NO_RESOURCE) {
726733
childArgs ++= Array("--primary-java-resource", args.primaryResource)
727734
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ class SparkSubmitSuite
406406
childArgsMap.get("--primary-java-resource") should be (Some("file:/home/thejar.jar"))
407407
childArgsMap.get("--main-class") should be (Some("org.SomeClass"))
408408
childArgsMap.get("--arg") should be (Some("arg1"))
409-
mainClass should be ("org.apache.spark.deploy.k8s.submit.Client")
409+
mainClass should be (KUBERNETES_CLUSTER_SUBMIT_CLASS)
410410
classpath should have length (0)
411411
conf.get("spark.executor.memory") should be ("5g")
412412
conf.get("spark.driver.memory") should be ("4g")

0 commit comments

Comments
 (0)