{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/comments/203715788","pull_request_review_id":138654624,"id":203715788,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMzcxNTc4OA==","diff_hunk":"@@ -0,0 +1,88 @@\n+# Copyright 2018 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#     http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+\"\"\"User friendly container for Google Cloud Bigtable MutationBatcher.\"\"\"\n+\n+\n+import sys\n+\n+FLUSH_COUNT = 1000\n+MAX_MUTATIONS = 100000\n+MAX_ROW_BYTES = 5242880  # 5MB\n+\n+\n+class MutationsBatcher(object):\n+    \"\"\" Batch mutations using limits MAX_ROW_BYTES, MAX_MUTATIONS and\n+    FLUSH_COUNT. A batch is sent to finish_batch() if any of these limits is\n+    exceeded.\n+\n+    :type table: class\n+    :param table: class:`~google.cloud.bigtable.table.Table`.\n+\n+    :type flush_count: int\n+    :param flush_count: (Optional) Max number of rows to flush. If it\n+    reaches the max number of rows it calls finish_batch() to mutate the\n+    current row batch. Default is FLUSH_COUNT (1000 rows).\n+\n+    :type max_mutations: int\n+    :param max_mutations: (Optional)  Max number of row mutations to flush.\n+    If it reaches the max number of row mutations it calls finish_batch() to\n+    mutate the current row batch. Default is MAX_MUTATIONS (100000 mutations).\n+\n+    :type max_row_bytes: int\n+    :param max_row_bytes: (Optional) Max number of row mutations size to\n+    flush. If it reaches the max number of row mutations size it calls\n+    finish_batch() to mutate the current row batch. Default is MAX_ROW_BYTES\n+    (5 MB).\n+    \"\"\"\n+\n+    def __init__(self, table, flush_count=FLUSH_COUNT,\n+                 max_mutations=MAX_MUTATIONS, max_row_bytes=MAX_ROW_BYTES):\n+        self.rows = []\n+        self.total_mutation_count = 0\n+        self.total_size = 0\n+        self.table = table\n+        self.flush_count = flush_count\n+        self.max_mutations = max_mutations\n+        self.max_row_bytes = max_row_bytes\n+\n+    def add_row(self, row):","path":"bigtable/google/cloud/bigtable/batcher.py","position":60,"original_position":60,"commit_id":"9a2ea788c21edceff1dbce212882b69b81ae76db","original_commit_id":"9a2ea788c21edceff1dbce212882b69b81ae76db","user":{"login":"sduskis","id":99305,"node_id":"MDQ6VXNlcjk5MzA1","avatar_url":"https://avatars3.githubusercontent.com/u/99305?v=4","gravatar_id":"","url":"https://api.github.com/users/sduskis","html_url":"https://github.com/sduskis","followers_url":"https://api.github.com/users/sduskis/followers","following_url":"https://api.github.com/users/sduskis/following{/other_user}","gists_url":"https://api.github.com/users/sduskis/gists{/gist_id}","starred_url":"https://api.github.com/users/sduskis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sduskis/subscriptions","organizations_url":"https://api.github.com/users/sduskis/orgs","repos_url":"https://api.github.com/users/sduskis/repos","events_url":"https://api.github.com/users/sduskis/events{/privacy}","received_events_url":"https://api.github.com/users/sduskis/received_events","type":"User","site_admin":false},"body":"Please call this method `mutate`","created_at":"2018-07-19T13:00:10Z","updated_at":"2018-07-19T13:31:28Z","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-python/pull/5651#discussion_r203715788","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/5651","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/comments/203715788"},"html":{"href":"https://github.com/GoogleCloudPlatform/google-cloud-python/pull/5651#discussion_r203715788"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/5651"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/5651","id":202466799,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyNDY2Nzk5","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-python/pull/5651","diff_url":"https://github.com/GoogleCloudPlatform/google-cloud-python/pull/5651.diff","patch_url":"https://github.com/GoogleCloudPlatform/google-cloud-python/pull/5651.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/5651","number":5651,"state":"open","locked":false,"title":"BigTable: Create MutationBatcher for bigtable","user":{"login":"aneepct","id":12858460,"node_id":"MDQ6VXNlcjEyODU4NDYw","avatar_url":"https://avatars2.githubusercontent.com/u/12858460?v=4","gravatar_id":"","url":"https://api.github.com/users/aneepct","html_url":"https://github.com/aneepct","followers_url":"https://api.github.com/users/aneepct/followers","following_url":"https://api.github.com/users/aneepct/following{/other_user}","gists_url":"https://api.github.com/users/aneepct/gists{/gist_id}","starred_url":"https://api.github.com/users/aneepct/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aneepct/subscriptions","organizations_url":"https://api.github.com/users/aneepct/orgs","repos_url":"https://api.github.com/users/aneepct/repos","events_url":"https://api.github.com/users/aneepct/events{/privacy}","received_events_url":"https://api.github.com/users/aneepct/received_events","type":"User","site_admin":false},"body":"Provide a facility for batching large numbers of mutations into configurable batch sizes, taking row count, max MB, and max mutations into account.\r\n\r\nEach batch will contain a list of DirectRow's which will be sent to the mutate_rows() method on Table.","created_at":"2018-07-19T07:21:53Z","updated_at":"2018-07-19T13:31:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"488470961fdc662d4d598302ed93e27d7d35471b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":131682747,"node_id":"MDU6TGFiZWwxMzE2ODI3NDc=","url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/labels/cla:%20yes","name":"cla: yes","color":"c2e0c6","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/5651/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/5651/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/5651/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/statuses/9a2ea788c21edceff1dbce212882b69b81ae76db","head":{"label":"zakons:feature/create_batcher_for_beam","ref":"feature/create_batcher_for_beam","sha":"9a2ea788c21edceff1dbce212882b69b81ae76db","user":{"login":"zakons","id":3955026,"node_id":"MDQ6VXNlcjM5NTUwMjY=","avatar_url":"https://avatars0.githubusercontent.com/u/3955026?v=4","gravatar_id":"","url":"https://api.github.com/users/zakons","html_url":"https://github.com/zakons","followers_url":"https://api.github.com/users/zakons/followers","following_url":"https://api.github.com/users/zakons/following{/other_user}","gists_url":"https://api.github.com/users/zakons/gists{/gist_id}","starred_url":"https://api.github.com/users/zakons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zakons/subscriptions","organizations_url":"https://api.github.com/users/zakons/orgs","repos_url":"https://api.github.com/users/zakons/repos","events_url":"https://api.github.com/users/zakons/events{/privacy}","received_events_url":"https://api.github.com/users/zakons/received_events","type":"User","site_admin":false},"repo":{"id":113809823,"node_id":"MDEwOlJlcG9zaXRvcnkxMTM4MDk4MjM=","name":"google-cloud-python","full_name":"zakons/google-cloud-python","owner":{"login":"zakons","id":3955026,"node_id":"MDQ6VXNlcjM5NTUwMjY=","avatar_url":"https://avatars0.githubusercontent.com/u/3955026?v=4","gravatar_id":"","url":"https://api.github.com/users/zakons","html_url":"https://github.com/zakons","followers_url":"https://api.github.com/users/zakons/followers","following_url":"https://api.github.com/users/zakons/following{/other_user}","gists_url":"https://api.github.com/users/zakons/gists{/gist_id}","starred_url":"https://api.github.com/users/zakons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zakons/subscriptions","organizations_url":"https://api.github.com/users/zakons/orgs","repos_url":"https://api.github.com/users/zakons/repos","events_url":"https://api.github.com/users/zakons/events{/privacy}","received_events_url":"https://api.github.com/users/zakons/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zakons/google-cloud-python","description":"Google Cloud Client Library for Python","fork":true,"url":"https://api.github.com/repos/zakons/google-cloud-python","forks_url":"https://api.github.com/repos/zakons/google-cloud-python/forks","keys_url":"https://api.github.com/repos/zakons/google-cloud-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zakons/google-cloud-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zakons/google-cloud-python/teams","hooks_url":"https://api.github.com/repos/zakons/google-cloud-python/hooks","issue_events_url":"https://api.github.com/repos/zakons/google-cloud-python/issues/events{/number}","events_url":"https://api.github.com/repos/zakons/google-cloud-python/events","assignees_url":"https://api.github.com/repos/zakons/google-cloud-python/assignees{/user}","branches_url":"https://api.github.com/repos/zakons/google-cloud-python/branches{/branch}","tags_url":"https://api.github.com/repos/zakons/google-cloud-python/tags","blobs_url":"https://api.github.com/repos/zakons/google-cloud-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zakons/google-cloud-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zakons/google-cloud-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/zakons/google-cloud-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zakons/google-cloud-python/statuses/{sha}","languages_url":"https://api.github.com/repos/zakons/google-cloud-python/languages","stargazers_url":"https://api.github.com/repos/zakons/google-cloud-python/stargazers","contributors_url":"https://api.github.com/repos/zakons/google-cloud-python/contributors","subscribers_url":"https://api.github.com/repos/zakons/google-cloud-python/subscribers","subscription_url":"https://api.github.com/repos/zakons/google-cloud-python/subscription","commits_url":"https://api.github.com/repos/zakons/google-cloud-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/zakons/google-cloud-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/zakons/google-cloud-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/zakons/google-cloud-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/zakons/google-cloud-python/contents/{+path}","compare_url":"https://api.github.com/repos/zakons/google-cloud-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zakons/google-cloud-python/merges","archive_url":"https://api.github.com/repos/zakons/google-cloud-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zakons/google-cloud-python/downloads","issues_url":"https://api.github.com/repos/zakons/google-cloud-python/issues{/number}","pulls_url":"https://api.github.com/repos/zakons/google-cloud-python/pulls{/number}","milestones_url":"https://api.github.com/repos/zakons/google-cloud-python/milestones{/number}","notifications_url":"https://api.github.com/repos/zakons/google-cloud-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zakons/google-cloud-python/labels{/name}","releases_url":"https://api.github.com/repos/zakons/google-cloud-python/releases{/id}","deployments_url":"https://api.github.com/repos/zakons/google-cloud-python/deployments","created_at":"2017-12-11T03:54:39Z","updated_at":"2018-07-19T07:03:17Z","pushed_at":"2018-07-19T07:16:40Z","git_url":"git://github.com/zakons/google-cloud-python.git","ssh_url":"git@github.com:zakons/google-cloud-python.git","clone_url":"https://github.com/zakons/google-cloud-python.git","svn_url":"https://github.com/zakons/google-cloud-python","homepage":"https://googlecloudplatform.github.io/google-cloud-python/","size":146526,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"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":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"6cb22b86557cd828c5934450f47aa9470d457944","user":{"login":"GoogleCloudPlatform","id":2810941,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4MTA5NDE=","avatar_url":"https://avatars0.githubusercontent.com/u/2810941?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":16316451,"node_id":"MDEwOlJlcG9zaXRvcnkxNjMxNjQ1MQ==","name":"google-cloud-python","full_name":"GoogleCloudPlatform/google-cloud-python","owner":{"login":"GoogleCloudPlatform","id":2810941,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4MTA5NDE=","avatar_url":"https://avatars0.githubusercontent.com/u/2810941?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/google-cloud-python","description":"Google Cloud Client Library for Python","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/deployments","created_at":"2014-01-28T15:51:47Z","updated_at":"2018-07-19T08:46:56Z","pushed_at":"2018-07-19T12:12:30Z","git_url":"git://github.com/GoogleCloudPlatform/google-cloud-python.git","ssh_url":"git@github.com:GoogleCloudPlatform/google-cloud-python.git","clone_url":"https://github.com/GoogleCloudPlatform/google-cloud-python.git","svn_url":"https://github.com/GoogleCloudPlatform/google-cloud-python","homepage":"https://googlecloudplatform.github.io/google-cloud-python/","size":191046,"stargazers_count":1607,"watchers_count":1607,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":704,"mirror_url":null,"archived":false,"open_issues_count":118,"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":704,"open_issues":118,"watchers":1607,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/5651"},"html":{"href":"https://github.com/GoogleCloudPlatform/google-cloud-python/pull/5651"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/5651"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/5651/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/5651/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/5651/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/statuses/9a2ea788c21edceff1dbce212882b69b81ae76db"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sduskis"}}