{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/78802398","id":78802398,"diff_hunk":"@@ -506,36 +505,41 @@ private[yarn] class YarnAllocator(\n         allocatedContainerToHostMap.put(containerId, executorHostname)\n       }\n \n-      if (launchContainers) {\n-        launcherPool.execute(new Runnable {\n-          override def run(): Unit = {\n-            try {\n-              new ExecutorRunnable(\n-                Some(container),\n-                conf,\n-                sparkConf,\n-                driverUrl,\n-                executorId,\n-                executorHostname,\n-                executorMemory,\n-                executorCores,\n-                appAttemptId.getApplicationId.toString,\n-                securityMgr,\n-                localResources\n-              ).run()\n-              updateInternalState()\n-            } catch {\n-              case NonFatal(e) =>\n-                logError(s\"Failed to launch executor $executorId on container $containerId\", e)\n-                // Assigned container should be released immediately to avoid unnecessary resource\n-                // occupation.\n-                amClient.releaseAssignedContainer(containerId)\n+      if (numExecutorsRunning < targetNumExecutors) {","path":"yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnAllocator.scala","position":36,"original_position":36,"commit_id":"5bca02d7232d18e9c5ef82855b112aa6d7b3104f","original_commit_id":"19d55b6f1ab65685ca9f2b5a29bcc595b8089d6c","user":{"login":"kishorvpatil","id":6090397,"avatar_url":"https://avatars.githubusercontent.com/u/6090397?v=3","gravatar_id":"","url":"https://api.github.com/users/kishorvpatil","html_url":"https://github.com/kishorvpatil","followers_url":"https://api.github.com/users/kishorvpatil/followers","following_url":"https://api.github.com/users/kishorvpatil/following{/other_user}","gists_url":"https://api.github.com/users/kishorvpatil/gists{/gist_id}","starred_url":"https://api.github.com/users/kishorvpatil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kishorvpatil/subscriptions","organizations_url":"https://api.github.com/users/kishorvpatil/orgs","repos_url":"https://api.github.com/users/kishorvpatil/repos","events_url":"https://api.github.com/users/kishorvpatil/events{/privacy}","received_events_url":"https://api.github.com/users/kishorvpatil/received_events","type":"User","site_admin":false},"body":"@tgravescs , I have added unit test for the same.","created_at":"2016-09-14T18:02:36Z","updated_at":"2016-09-14T18:02:36Z","html_url":"https://github.com/apache/spark/pull/15069#discussion_r78802398","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/15069","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/78802398"},"html":{"href":"https://github.com/apache/spark/pull/15069#discussion_r78802398"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/15069"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/15069","id":84973165,"html_url":"https://github.com/apache/spark/pull/15069","diff_url":"https://github.com/apache/spark/pull/15069.diff","patch_url":"https://github.com/apache/spark/pull/15069.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/15069","number":15069,"state":"open","locked":false,"title":"[SPARK-17511] Yarn Dynamic Allocation: Avoid marking released container as Failed","user":{"login":"kishorvpatil","id":6090397,"avatar_url":"https://avatars.githubusercontent.com/u/6090397?v=3","gravatar_id":"","url":"https://api.github.com/users/kishorvpatil","html_url":"https://github.com/kishorvpatil","followers_url":"https://api.github.com/users/kishorvpatil/followers","following_url":"https://api.github.com/users/kishorvpatil/following{/other_user}","gists_url":"https://api.github.com/users/kishorvpatil/gists{/gist_id}","starred_url":"https://api.github.com/users/kishorvpatil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kishorvpatil/subscriptions","organizations_url":"https://api.github.com/users/kishorvpatil/orgs","repos_url":"https://api.github.com/users/kishorvpatil/repos","events_url":"https://api.github.com/users/kishorvpatil/events{/privacy}","received_events_url":"https://api.github.com/users/kishorvpatil/received_events","type":"User","site_admin":false},"body":"## What changes were proposed in this pull request?\r\n\r\nDue to race conditions, the ` assert(numExecutorsRunning <= targetNumExecutors)` can fail causing `AssertionError`. So removed the assertion, instead moved the conditional check before launching new container:\r\n```\r\njava.lang.AssertionError: assertion failed\r\n        at scala.Predef$.assert(Predef.scala:156)\r\n        at org.apache.spark.deploy.yarn.YarnAllocator$$anonfun$runAllocatedContainers$1.org$apache$spark$deploy$yarn$YarnAllocator$$anonfun$$updateInternalState$1(YarnAllocator.scala:489)\r\n        at org.apache.spark.deploy.yarn.YarnAllocator$$anonfun$runAllocatedContainers$1$$anon$1.run(YarnAllocator.scala:519)\r\n        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\r\n        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\r\n        at java.lang.Thread.run(Thread.java:745)\r\n```\r\n## How was this patch tested?\r\nThis was manually tested using a large ForkAndJoin job with Dynamic Allocation enabled to validate the failing job succeeds, without any such exception.","created_at":"2016-09-13T01:45:48Z","updated_at":"2016-09-14T18:02:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"daa657cf253eceb12c18d541a306f79df2d2f2d1","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/15069/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/15069/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/15069/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/5bca02d7232d18e9c5ef82855b112aa6d7b3104f","head":{"label":"kishorvpatil:SPARK-17511","ref":"SPARK-17511","sha":"5bca02d7232d18e9c5ef82855b112aa6d7b3104f","user":{"login":"kishorvpatil","id":6090397,"avatar_url":"https://avatars.githubusercontent.com/u/6090397?v=3","gravatar_id":"","url":"https://api.github.com/users/kishorvpatil","html_url":"https://github.com/kishorvpatil","followers_url":"https://api.github.com/users/kishorvpatil/followers","following_url":"https://api.github.com/users/kishorvpatil/following{/other_user}","gists_url":"https://api.github.com/users/kishorvpatil/gists{/gist_id}","starred_url":"https://api.github.com/users/kishorvpatil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kishorvpatil/subscriptions","organizations_url":"https://api.github.com/users/kishorvpatil/orgs","repos_url":"https://api.github.com/users/kishorvpatil/repos","events_url":"https://api.github.com/users/kishorvpatil/events{/privacy}","received_events_url":"https://api.github.com/users/kishorvpatil/received_events","type":"User","site_admin":false},"repo":{"id":59697532,"name":"spark","full_name":"kishorvpatil/spark","owner":{"login":"kishorvpatil","id":6090397,"avatar_url":"https://avatars.githubusercontent.com/u/6090397?v=3","gravatar_id":"","url":"https://api.github.com/users/kishorvpatil","html_url":"https://github.com/kishorvpatil","followers_url":"https://api.github.com/users/kishorvpatil/followers","following_url":"https://api.github.com/users/kishorvpatil/following{/other_user}","gists_url":"https://api.github.com/users/kishorvpatil/gists{/gist_id}","starred_url":"https://api.github.com/users/kishorvpatil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kishorvpatil/subscriptions","organizations_url":"https://api.github.com/users/kishorvpatil/orgs","repos_url":"https://api.github.com/users/kishorvpatil/repos","events_url":"https://api.github.com/users/kishorvpatil/events{/privacy}","received_events_url":"https://api.github.com/users/kishorvpatil/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kishorvpatil/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/kishorvpatil/spark","forks_url":"https://api.github.com/repos/kishorvpatil/spark/forks","keys_url":"https://api.github.com/repos/kishorvpatil/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kishorvpatil/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kishorvpatil/spark/teams","hooks_url":"https://api.github.com/repos/kishorvpatil/spark/hooks","issue_events_url":"https://api.github.com/repos/kishorvpatil/spark/issues/events{/number}","events_url":"https://api.github.com/repos/kishorvpatil/spark/events","assignees_url":"https://api.github.com/repos/kishorvpatil/spark/assignees{/user}","branches_url":"https://api.github.com/repos/kishorvpatil/spark/branches{/branch}","tags_url":"https://api.github.com/repos/kishorvpatil/spark/tags","blobs_url":"https://api.github.com/repos/kishorvpatil/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kishorvpatil/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kishorvpatil/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/kishorvpatil/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kishorvpatil/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/kishorvpatil/spark/languages","stargazers_url":"https://api.github.com/repos/kishorvpatil/spark/stargazers","contributors_url":"https://api.github.com/repos/kishorvpatil/spark/contributors","subscribers_url":"https://api.github.com/repos/kishorvpatil/spark/subscribers","subscription_url":"https://api.github.com/repos/kishorvpatil/spark/subscription","commits_url":"https://api.github.com/repos/kishorvpatil/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/kishorvpatil/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/kishorvpatil/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/kishorvpatil/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/kishorvpatil/spark/contents/{+path}","compare_url":"https://api.github.com/repos/kishorvpatil/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kishorvpatil/spark/merges","archive_url":"https://api.github.com/repos/kishorvpatil/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kishorvpatil/spark/downloads","issues_url":"https://api.github.com/repos/kishorvpatil/spark/issues{/number}","pulls_url":"https://api.github.com/repos/kishorvpatil/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/kishorvpatil/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/kishorvpatil/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kishorvpatil/spark/labels{/name}","releases_url":"https://api.github.com/repos/kishorvpatil/spark/releases{/id}","deployments_url":"https://api.github.com/repos/kishorvpatil/spark/deployments","created_at":"2016-05-25T21:03:43Z","updated_at":"2016-05-25T21:04:05Z","pushed_at":"2016-09-14T18:00:19Z","git_url":"git://github.com/kishorvpatil/spark.git","ssh_url":"git@github.com:kishorvpatil/spark.git","clone_url":"https://github.com/kishorvpatil/spark.git","svn_url":"https://github.com/kishorvpatil/spark","homepage":null,"size":183891,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"a91ab705e8c124aa116c3e5b1f3ba88ce832dcde","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":17165658,"name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/spark","description":"Mirror of Apache Spark","fork":false,"url":"https://api.github.com/repos/apache/spark","forks_url":"https://api.github.com/repos/apache/spark/forks","keys_url":"https://api.github.com/repos/apache/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/spark/teams","hooks_url":"https://api.github.com/repos/apache/spark/hooks","issue_events_url":"https://api.github.com/repos/apache/spark/issues/events{/number}","events_url":"https://api.github.com/repos/apache/spark/events","assignees_url":"https://api.github.com/repos/apache/spark/assignees{/user}","branches_url":"https://api.github.com/repos/apache/spark/branches{/branch}","tags_url":"https://api.github.com/repos/apache/spark/tags","blobs_url":"https://api.github.com/repos/apache/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/spark/languages","stargazers_url":"https://api.github.com/repos/apache/spark/stargazers","contributors_url":"https://api.github.com/repos/apache/spark/contributors","subscribers_url":"https://api.github.com/repos/apache/spark/subscribers","subscription_url":"https://api.github.com/repos/apache/spark/subscription","commits_url":"https://api.github.com/repos/apache/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/spark/contents/{+path}","compare_url":"https://api.github.com/repos/apache/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/spark/merges","archive_url":"https://api.github.com/repos/apache/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/spark/downloads","issues_url":"https://api.github.com/repos/apache/spark/issues{/number}","pulls_url":"https://api.github.com/repos/apache/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/spark/labels{/name}","releases_url":"https://api.github.com/repos/apache/spark/releases{/id}","deployments_url":"https://api.github.com/repos/apache/spark/deployments","created_at":"2014-02-25T08:00:08Z","updated_at":"2016-09-14T14:49:17Z","pushed_at":"2016-09-14T18:00:22Z","git_url":"git://github.com/apache/spark.git","ssh_url":"git@github.com:apache/spark.git","clone_url":"https://github.com/apache/spark.git","svn_url":"https://github.com/apache/spark","homepage":null,"size":526276,"stargazers_count":10001,"watchers_count":10001,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":9326,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":487,"forks":9326,"open_issues":487,"watchers":10001,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/15069"},"html":{"href":"https://github.com/apache/spark/pull/15069"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/15069"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/15069/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/15069/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/15069/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/5bca02d7232d18e9c5ef82855b112aa6d7b3104f"}}}}
{"actor":{"display_login":"kishorvpatil"}}