dongjoon-hyun commented on code in PR #38357:
URL: https://github.com/apache/spark/pull/38357#discussion_r1051268075


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/KubernetesExecutorBackend.scala:
##########
@@ -49,7 +49,7 @@ private[spark] object KubernetesExecutorBackend extends 
Logging {
   def main(args: Array[String]): Unit = {
     val createFn: (RpcEnv, Arguments, SparkEnv, ResourceProfile, String) =>
       CoarseGrainedExecutorBackend = { case (rpcEnv, arguments, env, 
resourceProfile, execId) =>
-        new CoarseGrainedExecutorBackend(rpcEnv, arguments.driverUrl, execId,
+        new KubernetesCoarseGrainedExecutorBackend(rpcEnv, 
arguments.driverUrl, execId,
         arguments.bindAddress, arguments.hostname, arguments.cores,
         env, arguments.resourcesFileOpt, resourceProfile)

Review Comment:
   Instead of creating a new class `KubernetesCoarseGrainedExecutorBackend`, 
can we do the following simply?
   ```scala
            new CoarseGrainedExecutorBackend(rpcEnv, arguments.driverUrl, 
execId,
            arguments.bindAddress, arguments.hostname, arguments.cores,
   -        env, arguments.resourcesFileOpt, resourceProfile)
   +        env, arguments.resourcesFileOpt, resourceProfile) {
   +          override def getDriverAttributes: Option[Map[String, String]] = 
Some(
   +            super.getDriverAttributes.getOrElse(Map.empty) ++ Map(
   +              "APP_ID" -> System.getenv(ENV_APPLICATION_ID),
   +              "KUBERNETES_NAMESPACE" -> conf.get(KUBERNETES_NAMESPACE),
   +              "KUBERNETES_POD_NAME" -> System.getenv(ENV_DRIVER_POD_NAME)))
   +        }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to