You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@livy.apache.org by GitBox <gi...@apache.org> on 2019/11/20 06:42:55 UTC

[GitHub] [incubator-livy] yiheng commented on a change in pull request #242: [LIVY-336][WIP] Livy should not spawn one thread per job to track the job on Yarn

yiheng commented on a change in pull request #242: [LIVY-336][WIP] Livy should not spawn one thread per job to track the job on Yarn
URL: https://github.com/apache/incubator-livy/pull/242#discussion_r348313067
 
 

 ##########
 File path: server/src/main/scala/org/apache/livy/utils/SparkYarnApp.scala
 ##########
 @@ -98,7 +118,36 @@ object SparkYarnApp extends Logging {
     }
   }
 
+  val yarnAppMonitorThreadPool: ExecutorService =
+    Executors.newFixedThreadPool(yarnAppMonitorThreadPoolSize)
+
+  for (i <- 0 until yarnAppMonitorThreadPoolSize) {
+    yarnAppMonitorThreadPool.execute(new Runnable {
+      override def run(): Unit = {
+        var loop = true
+        try {
+          while (loop) {
+            val app = appQueue.poll()
+            if (app != null) {
+              app.monitorSparkYarnApp()
+            }
+
+            if (app.isRunning) {
+              appQueue.add(app)
+            }
+
+            Thread.sleep(yarnPollInterval)
+          }
+        } catch {
+          case _: InterruptedException => loop = false
 
 Review comment:
   Looks like this line is already outside of the while loop. So what's the meaning set loop to false?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services