turboFei commented on code in PR #2314:
URL: https://github.com/apache/incubator-kyuubi/pull/2314#discussion_r849550251


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilder.scala:
##########
@@ -193,28 +194,32 @@ class SparkProcessBuilder(
     }
   }
 
-  override def killApplication(line: String = 
lastRowsOfLog.toArray.mkString("\n")): String =
-    YARN_APP_NAME_REGEX.findFirstIn(line) match {
-      case Some(appId) =>
-        try {
-          val hadoopConf = KyuubiHadoopUtils.newHadoopConf(conf)
-          yarnClient.init(hadoopConf)
-          yarnClient.start()
-          val applicationId = ApplicationId.fromString(appId)
-          yarnClient.killApplication(applicationId)
-          s"Killed Application $appId successfully."
-        } catch {
-          case e: Throwable =>
-            s"Failed to kill Application $appId, please kill it manually." +
-              s" Caused by ${e.getMessage}."
-        } finally {
-          if (yarnClient != null) {
-            yarnClient.stop()
-          }
+  override def killApplication(engineRefId: String): String = {
+    val master = conf.getOption("spark.master").getOrElse("local")

Review Comment:
   FYI:
   ```
     private def getSparkDefaultsConf(): Map[String, String] = {
       val sparkDefaultsConfFile = env.get("SPARK_CONF_DIR")
         .orElse(env.get("SPARK_HOME").map(_ + "/conf"))
         .map(_ + "/spark-defaults.conf").map(new File(_))
         .filter(_.exists())
       Utils.getPropertiesFromFile(sparkDefaultsConfFile)
     }
   
   
conf.getOption("spark.master").getOrElse(getSparkDefaultsConf().get("spark.master"))
   ```
   
   You can use CONSTANT to replace above hard coded string value.



-- 
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