{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/34914574","id":34914574,"diff_hunk":"@@ -543,39 +544,72 @@ private[master] class Master(\n    * multiple executors from the same application may be launched on the same worker if the worker\n    * has enough cores and memory. Otherwise, each executor grabs all the cores available on the\n    * worker by default, in which case only one executor may be launched on each worker.\n+   *\n+   * It is important to allocate coresPerExecutor on each worker at a time (instead of 1 core\n+   * at a time). Consider the following example: cluster has 4 workers with 16 cores each.\n+   * User requests 3 executors (spark.cores.max = 48, spark.executor.cores = 16). If 1 core is\n+   * allocated at a time, 12 cores from each worker would be assigned to each executor.\n+   * Since 12 < 16, no executors would launch [SPARK-8881].\n    */\n-  private def startExecutorsOnWorkers(): Unit = {\n-    // Right now this is a very simple FIFO scheduler. We keep trying to fit in the first app\n-    // in the queue, then the second app, etc.\n+  private[master] def coresToAssign(","path":"core/src/main/scala/org/apache/spark/deploy/master/Master.scala","position":22,"original_position":22,"commit_id":"adec84be85e1a8a6d9a56fff044d1397a23370ba","original_commit_id":"adec84be85e1a8a6d9a56fff044d1397a23370ba","user":{"login":"andrewor14","id":2133137,"avatar_url":"https://avatars.githubusercontent.com/u/2133137?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewor14","html_url":"https://github.com/andrewor14","followers_url":"https://api.github.com/users/andrewor14/followers","following_url":"https://api.github.com/users/andrewor14/following{/other_user}","gists_url":"https://api.github.com/users/andrewor14/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewor14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewor14/subscriptions","organizations_url":"https://api.github.com/users/andrewor14/orgs","repos_url":"https://api.github.com/users/andrewor14/repos","events_url":"https://api.github.com/users/andrewor14/events{/privacy}","received_events_url":"https://api.github.com/users/andrewor14/received_events","type":"User","site_admin":false},"body":"you misunderstood me. I was asking you to rename the variable `toAssign` to `coresToAssign`. This method name should stay as `scheduleExecutorsOnWorkers` as before.","created_at":"2015-07-17T17:58:21Z","updated_at":"2015-07-17T17:58:21Z","html_url":"https://github.com/apache/spark/pull/7274#discussion_r34914574","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/7274","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/34914574"},"html":{"href":"https://github.com/apache/spark/pull/7274#discussion_r34914574"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/7274"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/7274","id":39430810,"html_url":"https://github.com/apache/spark/pull/7274","diff_url":"https://github.com/apache/spark/pull/7274.diff","patch_url":"https://github.com/apache/spark/pull/7274.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/7274","number":7274,"state":"open","locked":false,"title":"[SPARK-8881] Fix algorithm for scheduling executors on workers","user":{"login":"nishkamravi2","id":7054820,"avatar_url":"https://avatars.githubusercontent.com/u/7054820?v=3","gravatar_id":"","url":"https://api.github.com/users/nishkamravi2","html_url":"https://github.com/nishkamravi2","followers_url":"https://api.github.com/users/nishkamravi2/followers","following_url":"https://api.github.com/users/nishkamravi2/following{/other_user}","gists_url":"https://api.github.com/users/nishkamravi2/gists{/gist_id}","starred_url":"https://api.github.com/users/nishkamravi2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nishkamravi2/subscriptions","organizations_url":"https://api.github.com/users/nishkamravi2/orgs","repos_url":"https://api.github.com/users/nishkamravi2/repos","events_url":"https://api.github.com/users/nishkamravi2/events{/privacy}","received_events_url":"https://api.github.com/users/nishkamravi2/received_events","type":"User","site_admin":false},"body":"Current scheduling algorithm allocates one core at a time and in doing so ends up ignoring spark.executor.cores. As a result, when spark.cores.max/spark.executor.cores (i.e, num_executors) < num_workers, executors are not launched and the app hangs. This PR fixes and refactors the scheduling algorithm. \r\n\r\n@andrewor14 ","created_at":"2015-07-08T00:22:03Z","updated_at":"2015-07-17T17:58:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2f1138b19e0435f3194b8e053886d5ef3fb055f4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/7274/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/7274/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/7274/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/adec84be85e1a8a6d9a56fff044d1397a23370ba","head":{"label":"nishkamravi2:master_scheduler","ref":"master_scheduler","sha":"adec84be85e1a8a6d9a56fff044d1397a23370ba","user":{"login":"nishkamravi2","id":7054820,"avatar_url":"https://avatars.githubusercontent.com/u/7054820?v=3","gravatar_id":"","url":"https://api.github.com/users/nishkamravi2","html_url":"https://github.com/nishkamravi2","followers_url":"https://api.github.com/users/nishkamravi2/followers","following_url":"https://api.github.com/users/nishkamravi2/following{/other_user}","gists_url":"https://api.github.com/users/nishkamravi2/gists{/gist_id}","starred_url":"https://api.github.com/users/nishkamravi2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nishkamravi2/subscriptions","organizations_url":"https://api.github.com/users/nishkamravi2/orgs","repos_url":"https://api.github.com/users/nishkamravi2/repos","events_url":"https://api.github.com/users/nishkamravi2/events{/privacy}","received_events_url":"https://api.github.com/users/nishkamravi2/received_events","type":"User","site_admin":false},"repo":{"id":36787296,"name":"spark","full_name":"nishkamravi2/spark","owner":{"login":"nishkamravi2","id":7054820,"avatar_url":"https://avatars.githubusercontent.com/u/7054820?v=3","gravatar_id":"","url":"https://api.github.com/users/nishkamravi2","html_url":"https://github.com/nishkamravi2","followers_url":"https://api.github.com/users/nishkamravi2/followers","following_url":"https://api.github.com/users/nishkamravi2/following{/other_user}","gists_url":"https://api.github.com/users/nishkamravi2/gists{/gist_id}","starred_url":"https://api.github.com/users/nishkamravi2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nishkamravi2/subscriptions","organizations_url":"https://api.github.com/users/nishkamravi2/orgs","repos_url":"https://api.github.com/users/nishkamravi2/repos","events_url":"https://api.github.com/users/nishkamravi2/events{/privacy}","received_events_url":"https://api.github.com/users/nishkamravi2/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nishkamravi2/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/nishkamravi2/spark","forks_url":"https://api.github.com/repos/nishkamravi2/spark/forks","keys_url":"https://api.github.com/repos/nishkamravi2/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nishkamravi2/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nishkamravi2/spark/teams","hooks_url":"https://api.github.com/repos/nishkamravi2/spark/hooks","issue_events_url":"https://api.github.com/repos/nishkamravi2/spark/issues/events{/number}","events_url":"https://api.github.com/repos/nishkamravi2/spark/events","assignees_url":"https://api.github.com/repos/nishkamravi2/spark/assignees{/user}","branches_url":"https://api.github.com/repos/nishkamravi2/spark/branches{/branch}","tags_url":"https://api.github.com/repos/nishkamravi2/spark/tags","blobs_url":"https://api.github.com/repos/nishkamravi2/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nishkamravi2/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nishkamravi2/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/nishkamravi2/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nishkamravi2/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/nishkamravi2/spark/languages","stargazers_url":"https://api.github.com/repos/nishkamravi2/spark/stargazers","contributors_url":"https://api.github.com/repos/nishkamravi2/spark/contributors","subscribers_url":"https://api.github.com/repos/nishkamravi2/spark/subscribers","subscription_url":"https://api.github.com/repos/nishkamravi2/spark/subscription","commits_url":"https://api.github.com/repos/nishkamravi2/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/nishkamravi2/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/nishkamravi2/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/nishkamravi2/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/nishkamravi2/spark/contents/{+path}","compare_url":"https://api.github.com/repos/nishkamravi2/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nishkamravi2/spark/merges","archive_url":"https://api.github.com/repos/nishkamravi2/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nishkamravi2/spark/downloads","issues_url":"https://api.github.com/repos/nishkamravi2/spark/issues{/number}","pulls_url":"https://api.github.com/repos/nishkamravi2/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/nishkamravi2/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/nishkamravi2/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nishkamravi2/spark/labels{/name}","releases_url":"https://api.github.com/repos/nishkamravi2/spark/releases{/id}","created_at":"2015-06-03T07:30:26Z","updated_at":"2015-06-03T07:30:48Z","pushed_at":"2015-07-17T07:23:17Z","git_url":"git://github.com/nishkamravi2/spark.git","ssh_url":"git@github.com:nishkamravi2/spark.git","clone_url":"https://github.com/nishkamravi2/spark.git","svn_url":"https://github.com/nishkamravi2/spark","homepage":null,"size":110991,"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":"da56c4e728d6bdb6d5559ec7fd8a3f7ddd1e2319","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}","created_at":"2014-02-25T08:00:08Z","updated_at":"2015-07-17T13:49:35Z","pushed_at":"2015-07-17T17:53:31Z","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":1529818,"stargazers_count":4778,"watchers_count":4778,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4271,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":340,"forks":4271,"open_issues":340,"watchers":4778,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/7274"},"html":{"href":"https://github.com/apache/spark/pull/7274"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/7274"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/7274/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/7274/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/7274/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/adec84be85e1a8a6d9a56fff044d1397a23370ba"}}}}