Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1180#discussion_r15289308
  
    --- Diff: 
yarn/common/src/main/scala/org/apache/spark/scheduler/cluster/YarnClientSchedulerBackend.scala
 ---
    @@ -115,7 +117,30 @@ private[spark] class YarnClientSchedulerBackend(
         }
       }
     
    +  private def yarnApplicationStateCheckerThread(): Thread = {
    +    var sparkContextStop = false
    +    val t = new Thread {
    +      override def run() {
    +        while (!sparkContextStop) {
    +          val report = client.getApplicationReport(appId)
    +          val state = report.getYarnApplicationState()
    +          if (state != YarnApplicationState.RUNNING) {
    +            sparkContextStop = true
    +            logError(s"Yarn application already ended: $state")
    +            sc.stop()
    +          }
    +          Thread.sleep(1000L)
    +        }
    +      }
    +    }
    +    t.setDaemon(true)
    +    t.start()
    +    t
    +  }
    +
       override def stop() {
    +    checkerThread.interrupt()
    --- End diff --
    
    check to see if checkerThread != null before calling interrupt


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to