{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/207597180","pull_request_review_id":143243633,"id":207597180,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNzU5NzE4MA==","diff_hunk":"@@ -81,6 +82,17 @@ case class AggregateInPandasExec(\n \n     val bufferSize = inputRDD.conf.getInt(\"spark.buffer.size\", 65536)\n     val reuseWorker = inputRDD.conf.getBoolean(\"spark.python.worker.reuse\", defaultValue = true)\n+    val memoryMb = {","path":"sql/core/src/main/scala/org/apache/spark/sql/execution/python/AggregateInPandasExec.scala","position":12,"original_position":12,"commit_id":"a70720b275aa92d7b66281e942569d0d5d42068d","original_commit_id":"a70720b275aa92d7b66281e942569d0d5d42068d","user":{"login":"holdenk","id":59893,"node_id":"MDQ6VXNlcjU5ODkz","avatar_url":"https://avatars1.githubusercontent.com/u/59893?v=4","gravatar_id":"","url":"https://api.github.com/users/holdenk","html_url":"https://github.com/holdenk","followers_url":"https://api.github.com/users/holdenk/followers","following_url":"https://api.github.com/users/holdenk/following{/other_user}","gists_url":"https://api.github.com/users/holdenk/gists{/gist_id}","starred_url":"https://api.github.com/users/holdenk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/holdenk/subscriptions","organizations_url":"https://api.github.com/users/holdenk/orgs","repos_url":"https://api.github.com/users/holdenk/repos","events_url":"https://api.github.com/users/holdenk/events{/privacy}","received_events_url":"https://api.github.com/users/holdenk/received_events","type":"User","site_admin":false},"body":"This is minor, but this code block is repeated, would it make sense to factor out?","created_at":"2018-08-03T16:19:11Z","updated_at":"2018-08-03T16:40:32Z","html_url":"https://github.com/apache/spark/pull/21977#discussion_r207597180","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/21977","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/207597180"},"html":{"href":"https://github.com/apache/spark/pull/21977#discussion_r207597180"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/21977"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/21977","id":205838515,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1ODM4NTE1","html_url":"https://github.com/apache/spark/pull/21977","diff_url":"https://github.com/apache/spark/pull/21977.diff","patch_url":"https://github.com/apache/spark/pull/21977.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/21977","number":21977,"state":"open","locked":false,"title":"SPARK-25004: Add spark.executor.pyspark.memory limit.","user":{"login":"rdblue","id":87915,"node_id":"MDQ6VXNlcjg3OTE1","avatar_url":"https://avatars1.githubusercontent.com/u/87915?v=4","gravatar_id":"","url":"https://api.github.com/users/rdblue","html_url":"https://github.com/rdblue","followers_url":"https://api.github.com/users/rdblue/followers","following_url":"https://api.github.com/users/rdblue/following{/other_user}","gists_url":"https://api.github.com/users/rdblue/gists{/gist_id}","starred_url":"https://api.github.com/users/rdblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdblue/subscriptions","organizations_url":"https://api.github.com/users/rdblue/orgs","repos_url":"https://api.github.com/users/rdblue/repos","events_url":"https://api.github.com/users/rdblue/events{/privacy}","received_events_url":"https://api.github.com/users/rdblue/received_events","type":"User","site_admin":false},"body":"## What changes were proposed in this pull request?\r\n\r\nThis adds `spark.executor.pyspark.memory` to configure Python's address space limit, [`resource.RLIMIT_AS`](https://docs.python.org/3/library/resource.html#resource.RLIMIT_AS). Limiting Python's address space allows Python to participate in memory management. In practice, we see fewer cases of Python taking too much memory because it doesn't know to run garbage collection. This results in YARN killing fewer containers. This also improves error messages so users know that Python is consuming too much memory:\r\n\r\n```\r\n  File \"build/bdist.linux-x86_64/egg/package/library.py\", line 265, in fe_engineer\r\n    fe_eval_rec.update(f(src_rec_prep, mat_rec_prep))\r\n  File \"build/bdist.linux-x86_64/egg/package/library.py\", line 163, in fe_comp\r\n    comparisons = EvaluationUtils.leven_list_compare(src_rec_prep.get(item, []), mat_rec_prep.get(item, []))\r\n  File \"build/bdist.linux-x86_64/egg/package/evaluationutils.py\", line 25, in leven_list_compare\r\n    permutations = sorted(permutations, reverse=True)\r\n  MemoryError\r\n```\r\n\r\nThe new pyspark memory setting is used to increase requested YARN container memory, instead of sharing overhead memory between python and off-heap JVM activity.\r\n\r\n## How was this patch tested?\r\n\r\nTested memory limits in our YARN cluster and verified that MemoryError is thrown.","created_at":"2018-08-02T19:32:53Z","updated_at":"2018-08-03T16:40:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5bc9150c98158ea833ced386db8f4637d78fb261","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/21977/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/21977/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/21977/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/a70720b275aa92d7b66281e942569d0d5d42068d","head":{"label":"rdblue:SPARK-25004-add-python-memory-limit","ref":"SPARK-25004-add-python-memory-limit","sha":"a70720b275aa92d7b66281e942569d0d5d42068d","user":{"login":"rdblue","id":87915,"node_id":"MDQ6VXNlcjg3OTE1","avatar_url":"https://avatars1.githubusercontent.com/u/87915?v=4","gravatar_id":"","url":"https://api.github.com/users/rdblue","html_url":"https://github.com/rdblue","followers_url":"https://api.github.com/users/rdblue/followers","following_url":"https://api.github.com/users/rdblue/following{/other_user}","gists_url":"https://api.github.com/users/rdblue/gists{/gist_id}","starred_url":"https://api.github.com/users/rdblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdblue/subscriptions","organizations_url":"https://api.github.com/users/rdblue/orgs","repos_url":"https://api.github.com/users/rdblue/repos","events_url":"https://api.github.com/users/rdblue/events{/privacy}","received_events_url":"https://api.github.com/users/rdblue/received_events","type":"User","site_admin":false},"repo":{"id":26284539,"node_id":"MDEwOlJlcG9zaXRvcnkyNjI4NDUzOQ==","name":"spark","full_name":"rdblue/spark","owner":{"login":"rdblue","id":87915,"node_id":"MDQ6VXNlcjg3OTE1","avatar_url":"https://avatars1.githubusercontent.com/u/87915?v=4","gravatar_id":"","url":"https://api.github.com/users/rdblue","html_url":"https://github.com/rdblue","followers_url":"https://api.github.com/users/rdblue/followers","following_url":"https://api.github.com/users/rdblue/following{/other_user}","gists_url":"https://api.github.com/users/rdblue/gists{/gist_id}","starred_url":"https://api.github.com/users/rdblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdblue/subscriptions","organizations_url":"https://api.github.com/users/rdblue/orgs","repos_url":"https://api.github.com/users/rdblue/repos","events_url":"https://api.github.com/users/rdblue/events{/privacy}","received_events_url":"https://api.github.com/users/rdblue/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rdblue/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/rdblue/spark","forks_url":"https://api.github.com/repos/rdblue/spark/forks","keys_url":"https://api.github.com/repos/rdblue/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rdblue/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rdblue/spark/teams","hooks_url":"https://api.github.com/repos/rdblue/spark/hooks","issue_events_url":"https://api.github.com/repos/rdblue/spark/issues/events{/number}","events_url":"https://api.github.com/repos/rdblue/spark/events","assignees_url":"https://api.github.com/repos/rdblue/spark/assignees{/user}","branches_url":"https://api.github.com/repos/rdblue/spark/branches{/branch}","tags_url":"https://api.github.com/repos/rdblue/spark/tags","blobs_url":"https://api.github.com/repos/rdblue/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rdblue/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rdblue/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/rdblue/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rdblue/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/rdblue/spark/languages","stargazers_url":"https://api.github.com/repos/rdblue/spark/stargazers","contributors_url":"https://api.github.com/repos/rdblue/spark/contributors","subscribers_url":"https://api.github.com/repos/rdblue/spark/subscribers","subscription_url":"https://api.github.com/repos/rdblue/spark/subscription","commits_url":"https://api.github.com/repos/rdblue/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/rdblue/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/rdblue/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/rdblue/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/rdblue/spark/contents/{+path}","compare_url":"https://api.github.com/repos/rdblue/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rdblue/spark/merges","archive_url":"https://api.github.com/repos/rdblue/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rdblue/spark/downloads","issues_url":"https://api.github.com/repos/rdblue/spark/issues{/number}","pulls_url":"https://api.github.com/repos/rdblue/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/rdblue/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/rdblue/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rdblue/spark/labels{/name}","releases_url":"https://api.github.com/repos/rdblue/spark/releases{/id}","deployments_url":"https://api.github.com/repos/rdblue/spark/deployments","created_at":"2014-11-06T18:50:45Z","updated_at":"2017-09-13T03:31:54Z","pushed_at":"2018-08-02T23:00:11Z","git_url":"git://github.com/rdblue/spark.git","ssh_url":"git@github.com:rdblue/spark.git","clone_url":"https://github.com/rdblue/spark.git","svn_url":"https://github.com/rdblue/spark","homepage":null,"size":254619,"stargazers_count":1,"watchers_count":1,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"d0bc3ed6797e0c06f688b7b2ef6c26282a25b175","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnkxNzE2NTY1OA==","name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","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":"2018-08-03T13:36:44Z","pushed_at":"2018-08-03T16:37:16Z","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":278497,"stargazers_count":18288,"watchers_count":18288,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":16568,"mirror_url":null,"archived":false,"open_issues_count":491,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":16568,"open_issues":491,"watchers":18288,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/21977"},"html":{"href":"https://github.com/apache/spark/pull/21977"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/21977"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/21977/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/21977/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/21977/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/a70720b275aa92d7b66281e942569d0d5d42068d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"holdenk"}}