Skip to content

Commit

Permalink
Post-merge fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcelo Vanzin committed Dec 3, 2018
1 parent 3ee6d00 commit 791b5ee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ private[spark] class BasicExecutorFeatureStep(
val executorCpuQuantity = new QuantityBuilder(false)
.withAmount(executorCoresRequest)
.build()
<<<<<<< HEAD

val executorEnv: Seq[EnvVar] = {
(Seq(
Expand All @@ -98,8 +97,8 @@ private[spark] class BasicExecutorFeatureStep(
(ENV_APPLICATION_ID, kubernetesConf.appId),
// This is to set the SPARK_CONF_DIR to be /opt/spark/conf
(ENV_SPARK_CONF_DIR, SPARK_CONF_DIR_INTERNAL),
(ENV_EXECUTOR_ID, kubernetesConf.roleSpecificConf.executorId)
) ++ kubernetesConf.roleEnvs).map { case (k, v) =>
(ENV_EXECUTOR_ID, kubernetesConf.executorId)
) ++ kubernetesConf.environment).map { case (k, v) =>
new EnvVarBuilder()
.withName(k)
.withValue(v)
Expand All @@ -111,43 +110,6 @@ private[spark] class BasicExecutorFeatureStep(
.withValueFrom(new EnvVarSourceBuilder()
.withNewFieldRef("v1", "status.podIP")
.build())
=======
val executorExtraClasspathEnv = executorExtraClasspath.map { cp =>
new EnvVarBuilder()
.withName(ENV_CLASSPATH)
.withValue(cp)
.build()
}
val executorExtraJavaOptionsEnv = kubernetesConf
.get(EXECUTOR_JAVA_OPTIONS)
.map { opts =>
val subsOpts = Utils.substituteAppNExecIds(opts, kubernetesConf.appId,
kubernetesConf.executorId)
val delimitedOpts = Utils.splitCommandString(subsOpts)
delimitedOpts.zipWithIndex.map {
case (opt, index) =>
new EnvVarBuilder().withName(s"$ENV_JAVA_OPT_PREFIX$index").withValue(opt).build()
}
}.getOrElse(Seq.empty[EnvVar])
val executorEnv = (Seq(
(ENV_DRIVER_URL, driverUrl),
(ENV_EXECUTOR_CORES, executorCores.toString),
(ENV_EXECUTOR_MEMORY, executorMemoryString),
(ENV_APPLICATION_ID, kubernetesConf.appId),
// This is to set the SPARK_CONF_DIR to be /opt/spark/conf
(ENV_SPARK_CONF_DIR, SPARK_CONF_DIR_INTERNAL),
(ENV_EXECUTOR_ID, kubernetesConf.executorId)) ++
kubernetesConf.environment)
.map(env => new EnvVarBuilder()
.withName(env._1)
.withValue(env._2)
.build()
) ++ Seq(
new EnvVarBuilder()
.withName(ENV_EXECUTOR_POD_IP)
.withValueFrom(new EnvVarSourceBuilder()
.withNewFieldRef("v1", "status.podIP")
>>>>>>> master
.build())
} ++ {
Option(secMgr.getSecretKey()).map { authSecret =>
Expand All @@ -166,7 +128,7 @@ private[spark] class BasicExecutorFeatureStep(
} ++ {
val userOpts = kubernetesConf.get(EXECUTOR_JAVA_OPTIONS).toSeq.flatMap { opts =>
val subsOpts = Utils.substituteAppNExecIds(opts, kubernetesConf.appId,
kubernetesConf.roleSpecificConf.executorId)
kubernetesConf.executorId)
Utils.splitCommandString(subsOpts)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import org.apache.spark.deploy.k8s.features._

private[spark] class KubernetesExecutorBuilder(
provideBasicStep: (KubernetesExecutorConf, SecurityManager) => BasicExecutorFeatureStep =
new BasicExecutorFeatureStep(_),
new BasicExecutorFeatureStep(_, _),
provideSecretsStep: (KubernetesConf => MountSecretsFeatureStep) =
new MountSecretsFeatureStep(_),
provideEnvSecretsStep: (KubernetesConf => EnvSecretsFeatureStep) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class BasicExecutorFeatureStepSuite extends SparkFunSuite with BeforeAndAfter {
val step = new BasicExecutorFeatureStep(kconf, new SecurityManager(baseConf))
val executor = step.configurePod(SparkPod.initialPod())

checkEnv(executor, conf,
checkEnv(executor, baseConf,
Map("SPARK_JAVA_OPT_0" -> "foo=bar",
ENV_CLASSPATH -> "bar=baz",
"qux" -> "quux"))
Expand All @@ -151,19 +151,7 @@ class BasicExecutorFeatureStepSuite extends SparkFunSuite with BeforeAndAfter {
val secMgr = new SecurityManager(conf)
secMgr.initializeAuth()

val step = new BasicExecutorFeatureStep(
KubernetesConf(
conf,
KubernetesExecutorSpecificConf("1", Some(DRIVER_POD)),
RESOURCE_NAME_PREFIX,
APP_ID,
LABELS,
ANNOTATIONS,
Map.empty,
Map.empty,
Map.empty,
Nil,
hadoopConfSpec = None),
val step = new BasicExecutorFeatureStep(KubernetesTestConf.createExecutorConf(sparkConf = conf),
secMgr)

val executor = step.configurePod(SparkPod.initialPod())
Expand Down

0 comments on commit 791b5ee

Please sign in to comment.