{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/rally/pulls/comments/89279345","pull_request_review_id":9822560,"id":89279345,"diff_hunk":"@@ -197,25 +198,39 @@ def __init__(self, indices, params):\n                                            (id_conflicts, action_metadata))\n \n         self.pipeline = params.get(\"pipeline\", None)\n-        try:\n-            self.bulk_size = int(params[\"bulk-size\"])\n-            if self.bulk_size <= 0:\n-                raise exceptions.InvalidSyntax(\"'bulk-size' must be positive but was %d\" % self.bulk_size)\n-        except KeyError:\n-            raise exceptions.InvalidSyntax(\"Mandatory parameter 'bulk-size' is missing\")\n-        except ValueError:\n-            raise exceptions.InvalidSyntax(\"'bulk-size' must be numeric\")\n-\n-        try:\n-            self.batch_size = int(params.get(\"batch-size\", self.bulk_size))\n-            if self.batch_size <= 0:\n-                raise exceptions.InvalidSyntax(\"'batch-size' must be positive but was %d\" % self.batch_size)\n-            if self.batch_size < self.bulk_size:\n-                raise exceptions.InvalidSyntax(\"'batch-size' must be greater than or equal to 'bulk-size'\")\n-            if self.batch_size % self.bulk_size != 0:\n-                raise exceptions.InvalidSyntax(\"'batch-size' must be a multiple of 'bulk-size'\")\n-        except ValueError:\n-            raise exceptions.InvalidSyntax(\"'batch-size' must be numeric\")\n+        def handler_size_number(params_size, params_key):\n+            #regexp the size with unit\n+            if_with_unit = re.findall(r'(\\d+)([kKmMgGbB]+)', params_size)\n+            # not with unit\n+            if len(if_with_unit) == 0:\n+                try:\n+                    temp_size = int(params_size)\n+                    if temp_size <=0:\n+                        raise exceptions.InvalidSyntax(\"'%s' must be positive but was %d\" % (params_key, params_size))\n+                except ValueError:\n+                    raise exceptions.InvalidSyntax(\"'%s' must be numeric\"% (params_key) )\n+            else:\n+                temp_size = if_with_unit[0][0]\n+                temp_unit = if_with_unit[0][1].upper()\n+                if temp_unit == \"GB\":\n+                    temp_size = int(float(temp_size) * 1024 * 1024 * 1024)\n+                elif temp_unit == \"MB\":\n+                    temp_size = int(float(temp_size) * 1024 * 1024)\n+                elif temp_unit == \"KB\":\n+                    temp_size = int(float(temp_size) * 1024)\n+                else:\n+                    raise AttributeError(\"'%s' unit '%s' must be KB/MB/GB\" % (params_size, temp_size))\n+            return temp_size\n+\n+        for key in [\"bulk-size\", \"batch_size\"]:\n+            if key not in params:\n+                raise KeyError(\"Mandatory parameter '%s' is missing\" % (key))\n+        self.bulk_size = handler_size_number(params[\"bulk-size\"], \"bulk-size\")\n+        self.batch_size = handler_size_number(params[\"batch_size\"], \"batch_size\")","path":"esrally/track/params.py","position":59,"original_position":59,"commit_id":"01a2b55c2b7037c31e81aa093ff105f47718ee39","original_commit_id":"01a2b55c2b7037c31e81aa093ff105f47718ee39","user":{"login":"danielmitterdorfer","id":1699576,"avatar_url":"https://avatars.githubusercontent.com/u/1699576?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmitterdorfer","html_url":"https://github.com/danielmitterdorfer","followers_url":"https://api.github.com/users/danielmitterdorfer/followers","following_url":"https://api.github.com/users/danielmitterdorfer/following{/other_user}","gists_url":"https://api.github.com/users/danielmitterdorfer/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmitterdorfer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmitterdorfer/subscriptions","organizations_url":"https://api.github.com/users/danielmitterdorfer/orgs","repos_url":"https://api.github.com/users/danielmitterdorfer/repos","events_url":"https://api.github.com/users/danielmitterdorfer/events{/privacy}","received_events_url":"https://api.github.com/users/danielmitterdorfer/received_events","type":"User","site_admin":false},"body":"Some of my comments on `self.bulk_size` above apply here similarly.","created_at":"2016-11-23T09:31:58Z","updated_at":"2016-11-23T09:33:55Z","html_url":"https://github.com/elastic/rally/pull/186#discussion_r89279345","pull_request_url":"https://api.github.com/repos/elastic/rally/pulls/186","_links":{"self":{"href":"https://api.github.com/repos/elastic/rally/pulls/comments/89279345"},"html":{"href":"https://github.com/elastic/rally/pull/186#discussion_r89279345"},"pull_request":{"href":"https://api.github.com/repos/elastic/rally/pulls/186"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/rally/pulls/186","id":94743961,"html_url":"https://github.com/elastic/rally/pull/186","diff_url":"https://github.com/elastic/rally/pull/186.diff","patch_url":"https://github.com/elastic/rally/pull/186.patch","issue_url":"https://api.github.com/repos/elastic/rally/issues/186","number":186,"state":"open","locked":false,"title":"support bulk-size/batch_size with unit kb|mb|gb","user":{"login":"jomenxiao","id":4003391,"avatar_url":"https://avatars.githubusercontent.com/u/4003391?v=3","gravatar_id":"","url":"https://api.github.com/users/jomenxiao","html_url":"https://github.com/jomenxiao","followers_url":"https://api.github.com/users/jomenxiao/followers","following_url":"https://api.github.com/users/jomenxiao/following{/other_user}","gists_url":"https://api.github.com/users/jomenxiao/gists{/gist_id}","starred_url":"https://api.github.com/users/jomenxiao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jomenxiao/subscriptions","organizations_url":"https://api.github.com/users/jomenxiao/orgs","repos_url":"https://api.github.com/users/jomenxiao/repos","events_url":"https://api.github.com/users/jomenxiao/events{/privacy}","received_events_url":"https://api.github.com/users/jomenxiao/received_events","type":"User","site_admin":false},"body":"support bulk-size/batch_size with unit kb|mb|gb   #121","created_at":"2016-11-22T03:53:56Z","updated_at":"2016-11-23T09:33:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"58ebe66111133cc1f754a0ba9ed6514e7bd92dbc","assignee":{"login":"danielmitterdorfer","id":1699576,"avatar_url":"https://avatars.githubusercontent.com/u/1699576?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmitterdorfer","html_url":"https://github.com/danielmitterdorfer","followers_url":"https://api.github.com/users/danielmitterdorfer/followers","following_url":"https://api.github.com/users/danielmitterdorfer/following{/other_user}","gists_url":"https://api.github.com/users/danielmitterdorfer/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmitterdorfer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmitterdorfer/subscriptions","organizations_url":"https://api.github.com/users/danielmitterdorfer/orgs","repos_url":"https://api.github.com/users/danielmitterdorfer/repos","events_url":"https://api.github.com/users/danielmitterdorfer/events{/privacy}","received_events_url":"https://api.github.com/users/danielmitterdorfer/received_events","type":"User","site_admin":false},"assignees":[{"login":"danielmitterdorfer","id":1699576,"avatar_url":"https://avatars.githubusercontent.com/u/1699576?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmitterdorfer","html_url":"https://github.com/danielmitterdorfer","followers_url":"https://api.github.com/users/danielmitterdorfer/followers","following_url":"https://api.github.com/users/danielmitterdorfer/following{/other_user}","gists_url":"https://api.github.com/users/danielmitterdorfer/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmitterdorfer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmitterdorfer/subscriptions","organizations_url":"https://api.github.com/users/danielmitterdorfer/orgs","repos_url":"https://api.github.com/users/danielmitterdorfer/repos","events_url":"https://api.github.com/users/danielmitterdorfer/events{/privacy}","received_events_url":"https://api.github.com/users/danielmitterdorfer/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/elastic/rally/pulls/186/commits","review_comments_url":"https://api.github.com/repos/elastic/rally/pulls/186/comments","review_comment_url":"https://api.github.com/repos/elastic/rally/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/rally/issues/186/comments","statuses_url":"https://api.github.com/repos/elastic/rally/statuses/01a2b55c2b7037c31e81aa093ff105f47718ee39","head":{"label":"jomenxiao:fix_size_with_unit","ref":"fix_size_with_unit","sha":"01a2b55c2b7037c31e81aa093ff105f47718ee39","user":{"login":"jomenxiao","id":4003391,"avatar_url":"https://avatars.githubusercontent.com/u/4003391?v=3","gravatar_id":"","url":"https://api.github.com/users/jomenxiao","html_url":"https://github.com/jomenxiao","followers_url":"https://api.github.com/users/jomenxiao/followers","following_url":"https://api.github.com/users/jomenxiao/following{/other_user}","gists_url":"https://api.github.com/users/jomenxiao/gists{/gist_id}","starred_url":"https://api.github.com/users/jomenxiao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jomenxiao/subscriptions","organizations_url":"https://api.github.com/users/jomenxiao/orgs","repos_url":"https://api.github.com/users/jomenxiao/repos","events_url":"https://api.github.com/users/jomenxiao/events{/privacy}","received_events_url":"https://api.github.com/users/jomenxiao/received_events","type":"User","site_admin":false},"repo":{"id":74093127,"name":"rally","full_name":"jomenxiao/rally","owner":{"login":"jomenxiao","id":4003391,"avatar_url":"https://avatars.githubusercontent.com/u/4003391?v=3","gravatar_id":"","url":"https://api.github.com/users/jomenxiao","html_url":"https://github.com/jomenxiao","followers_url":"https://api.github.com/users/jomenxiao/followers","following_url":"https://api.github.com/users/jomenxiao/following{/other_user}","gists_url":"https://api.github.com/users/jomenxiao/gists{/gist_id}","starred_url":"https://api.github.com/users/jomenxiao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jomenxiao/subscriptions","organizations_url":"https://api.github.com/users/jomenxiao/orgs","repos_url":"https://api.github.com/users/jomenxiao/repos","events_url":"https://api.github.com/users/jomenxiao/events{/privacy}","received_events_url":"https://api.github.com/users/jomenxiao/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jomenxiao/rally","description":"Macrobenchmarking framework for Elasticsearch","fork":true,"url":"https://api.github.com/repos/jomenxiao/rally","forks_url":"https://api.github.com/repos/jomenxiao/rally/forks","keys_url":"https://api.github.com/repos/jomenxiao/rally/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jomenxiao/rally/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jomenxiao/rally/teams","hooks_url":"https://api.github.com/repos/jomenxiao/rally/hooks","issue_events_url":"https://api.github.com/repos/jomenxiao/rally/issues/events{/number}","events_url":"https://api.github.com/repos/jomenxiao/rally/events","assignees_url":"https://api.github.com/repos/jomenxiao/rally/assignees{/user}","branches_url":"https://api.github.com/repos/jomenxiao/rally/branches{/branch}","tags_url":"https://api.github.com/repos/jomenxiao/rally/tags","blobs_url":"https://api.github.com/repos/jomenxiao/rally/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jomenxiao/rally/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jomenxiao/rally/git/refs{/sha}","trees_url":"https://api.github.com/repos/jomenxiao/rally/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jomenxiao/rally/statuses/{sha}","languages_url":"https://api.github.com/repos/jomenxiao/rally/languages","stargazers_url":"https://api.github.com/repos/jomenxiao/rally/stargazers","contributors_url":"https://api.github.com/repos/jomenxiao/rally/contributors","subscribers_url":"https://api.github.com/repos/jomenxiao/rally/subscribers","subscription_url":"https://api.github.com/repos/jomenxiao/rally/subscription","commits_url":"https://api.github.com/repos/jomenxiao/rally/commits{/sha}","git_commits_url":"https://api.github.com/repos/jomenxiao/rally/git/commits{/sha}","comments_url":"https://api.github.com/repos/jomenxiao/rally/comments{/number}","issue_comment_url":"https://api.github.com/repos/jomenxiao/rally/issues/comments{/number}","contents_url":"https://api.github.com/repos/jomenxiao/rally/contents/{+path}","compare_url":"https://api.github.com/repos/jomenxiao/rally/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jomenxiao/rally/merges","archive_url":"https://api.github.com/repos/jomenxiao/rally/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jomenxiao/rally/downloads","issues_url":"https://api.github.com/repos/jomenxiao/rally/issues{/number}","pulls_url":"https://api.github.com/repos/jomenxiao/rally/pulls{/number}","milestones_url":"https://api.github.com/repos/jomenxiao/rally/milestones{/number}","notifications_url":"https://api.github.com/repos/jomenxiao/rally/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jomenxiao/rally/labels{/name}","releases_url":"https://api.github.com/repos/jomenxiao/rally/releases{/id}","deployments_url":"https://api.github.com/repos/jomenxiao/rally/deployments","created_at":"2016-11-18T03:47:14Z","updated_at":"2016-11-18T03:47:15Z","pushed_at":"2016-11-22T03:50:49Z","git_url":"git://github.com/jomenxiao/rally.git","ssh_url":"git@github.com:jomenxiao/rally.git","clone_url":"https://github.com/jomenxiao/rally.git","svn_url":"https://github.com/jomenxiao/rally","homepage":"","size":1619,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"elastic:master","ref":"master","sha":"be29b3334dc8a5d156387d053882f5b2d31b2285","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":47140131,"name":"rally","full_name":"elastic/rally","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/rally","description":"Macrobenchmarking framework for Elasticsearch","fork":false,"url":"https://api.github.com/repos/elastic/rally","forks_url":"https://api.github.com/repos/elastic/rally/forks","keys_url":"https://api.github.com/repos/elastic/rally/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/rally/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/rally/teams","hooks_url":"https://api.github.com/repos/elastic/rally/hooks","issue_events_url":"https://api.github.com/repos/elastic/rally/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/rally/events","assignees_url":"https://api.github.com/repos/elastic/rally/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/rally/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/rally/tags","blobs_url":"https://api.github.com/repos/elastic/rally/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/rally/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/rally/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/rally/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/rally/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/rally/languages","stargazers_url":"https://api.github.com/repos/elastic/rally/stargazers","contributors_url":"https://api.github.com/repos/elastic/rally/contributors","subscribers_url":"https://api.github.com/repos/elastic/rally/subscribers","subscription_url":"https://api.github.com/repos/elastic/rally/subscription","commits_url":"https://api.github.com/repos/elastic/rally/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/rally/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/rally/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/rally/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/rally/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/rally/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/rally/merges","archive_url":"https://api.github.com/repos/elastic/rally/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/rally/downloads","issues_url":"https://api.github.com/repos/elastic/rally/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/rally/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/rally/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/rally/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/rally/labels{/name}","releases_url":"https://api.github.com/repos/elastic/rally/releases{/id}","deployments_url":"https://api.github.com/repos/elastic/rally/deployments","created_at":"2015-11-30T19:11:43Z","updated_at":"2016-11-21T14:29:34Z","pushed_at":"2016-11-22T13:51:37Z","git_url":"git://github.com/elastic/rally.git","ssh_url":"git@github.com:elastic/rally.git","clone_url":"https://github.com/elastic/rally.git","svn_url":"https://github.com/elastic/rally","homepage":"","size":1648,"stargazers_count":119,"watchers_count":119,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":28,"forks":21,"open_issues":28,"watchers":119,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/rally/pulls/186"},"html":{"href":"https://github.com/elastic/rally/pull/186"},"issue":{"href":"https://api.github.com/repos/elastic/rally/issues/186"},"comments":{"href":"https://api.github.com/repos/elastic/rally/issues/186/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/rally/pulls/186/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/rally/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/rally/pulls/186/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/rally/statuses/01a2b55c2b7037c31e81aa093ff105f47718ee39"}}}}
{"actor":{"display_login":"danielmitterdorfer"}}