vanzin commented on a change in pull request #19616: [SPARK-22404][YARN] 
Provide an option to use unmanaged AM in yarn-client mode
URL: https://github.com/apache/spark/pull/19616#discussion_r242714148
 
 

 ##########
 File path: 
resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala
 ##########
 @@ -234,20 +218,26 @@ private[spark] class ApplicationMaster(args: 
ApplicationMasterArguments) extends
     resources.toMap
   }
 
-  def getAttemptId(): ApplicationAttemptId = {
-    client.getAttemptId()
+  def getAttemptId(sparkConf: SparkConf): ApplicationAttemptId = {
+    client.getAttemptId(sparkConf)
   }
 
   final def run(): Int = {
     doAsUser {
-      runImpl()
+      runImpl(
+        if (isClusterMode) {
+          runDriver()
+        } else {
+          runExecutorLauncher()
+        }
+      )
     }
     exitCode
   }
 
-  private def runImpl(): Unit = {
+  private def runImpl(opBlock: => Unit): Unit = {
 
 Review comment:
   There are things in this method that don't look right when you think about 
an unmanaged AM.
   
   e.g., overriding `spark.master`, `spark.ui.port`, etc, look wrong.
   
   The handling of app attempts also seems wrong, since with an unmanaged AM 
you don't have multiple attempts. Even the shutdown hooks seems a bit out of 
place.
   
   Seems to me it would be easier not to try to use this method for the 
unmanaged AM.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to