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

    https://github.com/apache/spark/pull/1180#discussion_r15289735
  
    --- 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) {
    --- End diff --
    
    There are other states the application could be in that are fine.  like 
SUBMITTED, ACCEPTED. I realize waitForApp waits for the running state, but  I 
think it would be better to check if it is in one of the finished states, then 
we stop it:
    
    appReport.getYarnApplicationState() == YarnApplicationState.FINISHED
            || appReport.getYarnApplicationState() == 
YarnApplicationState.KILLED
            || appReport.getYarnApplicationState() == 
YarnApplicationState.FAILED


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