{"action":"created","comment":{"url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/pulls/comments/32921567","id":32921567,"diff_hunk":"@@ -58,55 +77,68 @@ object SimpleStreamingApp {\n     System.exit(0)\n   }\n \n-  private def format(batchTime: Long, stats: (Int, (Int, Long, Double, Double, Long))): String = {\n-    s\"${stats._2._5}\\t$batchTime\\t${stats._1}\\t${stats._2._1}\\t${stats._2._2}\\t${stats._2._3}\\t${stats._2._4}\"\n+  private def format(batchTime: Long, input: Int, stats: Stats): String = {\n+    s\"${stats.millis}\\t$batchTime\\t$input\\t${stats.count}\\t${stats.sum}\\t${stats.mean}\\t${stats.stdDev}\"\n   }\n \n-  /**\n-   * Returns count, sum, mean and standard deviation\n+  /** Returns count, sum, mean and standard deviation\n    *\n    */\n-  private def stats(value: Iterable[Long]): (Int, Long, Double, Double, Long) = {\n+  private def stats(value: Iterable[Long]): Stats = {\n     val (count, sum, sqrsum) = value.foldLeft((0, 0L, 0L)) { (acc, v) =>\n       // acc: count, sum, sum of squared\n       (acc._1 + 1, acc._2 + v, acc._3 + v * v)\n     }\n     val mean = sum.toDouble / count\n     val stddev = math.sqrt(count * sqrsum - sum * sum) / count\n-    (count, sum, mean, stddev, System.currentTimeMillis())\n+    Stats(count, sum, mean, stddev, System.currentTimeMillis())\n   }\n \n-  private def usageAndExit(message: String): Nothing = {\n-    println(s\"\"\"$message\n-Usage:\n-  SimpleStreamingApp <stream_hostname> <stream_port> <congestion strategy> <batch interval milliseconds>\"\"\")\n-    System.exit(1)\n-    throw new Exception(\"Never reached\")\n+  val DefaultConfig = Config(\"local[*]\", \"\", -1, 1000, \"ignore\", 1, 1)\n+\n+  private val parser = new OptionParser[Config](\"simple-streaming\") {\n+    help(\"help\")\n+      .text(\"Prints this usage text\")","path":"simple-streaming-app/src/main/scala/com/typesafe/spark/SimpleStreamingApp.scala","position":95,"original_position":95,"commit_id":"b31cd56d6dbf159037d171e2405a42fca10f94c7","original_commit_id":"b31cd56d6dbf159037d171e2405a42fca10f94c7","user":{"login":"skyluc","id":1098830,"avatar_url":"https://avatars.githubusercontent.com/u/1098830?v=3","gravatar_id":"","url":"https://api.github.com/users/skyluc","html_url":"https://github.com/skyluc","followers_url":"https://api.github.com/users/skyluc/followers","following_url":"https://api.github.com/users/skyluc/following{/other_user}","gists_url":"https://api.github.com/users/skyluc/gists{/gist_id}","starred_url":"https://api.github.com/users/skyluc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skyluc/subscriptions","organizations_url":"https://api.github.com/users/skyluc/orgs","repos_url":"https://api.github.com/users/skyluc/repos","events_url":"https://api.github.com/users/skyluc/events{/privacy}","received_events_url":"https://api.github.com/users/skyluc/received_events","type":"User","site_admin":false},"body":"we need to do a doc update pass on this project after we merge this pull request.","created_at":"2015-06-22T10:36:23Z","updated_at":"2015-06-22T10:36:23Z","html_url":"https://github.com/skyluc/spark-streaming-testbed/pull/5#discussion_r32921567","pull_request_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/skyluc/spark-streaming-testbed/pulls/comments/32921567"},"html":{"href":"https://github.com/skyluc/spark-streaming-testbed/pull/5#discussion_r32921567"},"pull_request":{"href":"https://api.github.com/repos/skyluc/spark-streaming-testbed/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/pulls/5","id":37914144,"html_url":"https://github.com/skyluc/spark-streaming-testbed/pull/5","diff_url":"https://github.com/skyluc/spark-streaming-testbed/pull/5.diff","patch_url":"https://github.com/skyluc/spark-streaming-testbed/pull/5.patch","issue_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/issues/5","number":5,"state":"open","locked":false,"title":"Cleanup command line options and make receivers configurable","user":{"login":"dragos","id":133742,"avatar_url":"https://avatars.githubusercontent.com/u/133742?v=3","gravatar_id":"","url":"https://api.github.com/users/dragos","html_url":"https://github.com/dragos","followers_url":"https://api.github.com/users/dragos/followers","following_url":"https://api.github.com/users/dragos/following{/other_user}","gists_url":"https://api.github.com/users/dragos/gists{/gist_id}","starred_url":"https://api.github.com/users/dragos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dragos/subscriptions","organizations_url":"https://api.github.com/users/dragos/orgs","repos_url":"https://api.github.com/users/dragos/repos","events_url":"https://api.github.com/users/dragos/events{/privacy}","received_events_url":"https://api.github.com/users/dragos/received_events","type":"User","site_admin":false},"body":"The second stream has twice as many elements as the first (though they come from the same producer).","created_at":"2015-06-17T15:33:39Z","updated_at":"2015-06-22T10:36:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1a282af3caa9809d54cdfb5c9700c33299f883f5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/pulls/5/commits","review_comments_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/pulls/5/comments","review_comment_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/pulls/comments{/number}","comments_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/issues/5/comments","statuses_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/statuses/b31cd56d6dbf159037d171e2405a42fca10f94c7","head":{"label":"dragos:minor/use-caseclass","ref":"minor/use-caseclass","sha":"b31cd56d6dbf159037d171e2405a42fca10f94c7","user":{"login":"dragos","id":133742,"avatar_url":"https://avatars.githubusercontent.com/u/133742?v=3","gravatar_id":"","url":"https://api.github.com/users/dragos","html_url":"https://github.com/dragos","followers_url":"https://api.github.com/users/dragos/followers","following_url":"https://api.github.com/users/dragos/following{/other_user}","gists_url":"https://api.github.com/users/dragos/gists{/gist_id}","starred_url":"https://api.github.com/users/dragos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dragos/subscriptions","organizations_url":"https://api.github.com/users/dragos/orgs","repos_url":"https://api.github.com/users/dragos/repos","events_url":"https://api.github.com/users/dragos/events{/privacy}","received_events_url":"https://api.github.com/users/dragos/received_events","type":"User","site_admin":false},"repo":{"id":37603577,"name":"spark-streaming-testbed","full_name":"dragos/spark-streaming-testbed","owner":{"login":"dragos","id":133742,"avatar_url":"https://avatars.githubusercontent.com/u/133742?v=3","gravatar_id":"","url":"https://api.github.com/users/dragos","html_url":"https://github.com/dragos","followers_url":"https://api.github.com/users/dragos/followers","following_url":"https://api.github.com/users/dragos/following{/other_user}","gists_url":"https://api.github.com/users/dragos/gists{/gist_id}","starred_url":"https://api.github.com/users/dragos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dragos/subscriptions","organizations_url":"https://api.github.com/users/dragos/orgs","repos_url":"https://api.github.com/users/dragos/repos","events_url":"https://api.github.com/users/dragos/events{/privacy}","received_events_url":"https://api.github.com/users/dragos/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dragos/spark-streaming-testbed","description":"","fork":true,"url":"https://api.github.com/repos/dragos/spark-streaming-testbed","forks_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/forks","keys_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/teams","hooks_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/hooks","issue_events_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/issues/events{/number}","events_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/events","assignees_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/assignees{/user}","branches_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/branches{/branch}","tags_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/tags","blobs_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/git/refs{/sha}","trees_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/statuses/{sha}","languages_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/languages","stargazers_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/stargazers","contributors_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/contributors","subscribers_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/subscribers","subscription_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/subscription","commits_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/commits{/sha}","git_commits_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/git/commits{/sha}","comments_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/comments{/number}","issue_comment_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/issues/comments{/number}","contents_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/contents/{+path}","compare_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/merges","archive_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/downloads","issues_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/issues{/number}","pulls_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/pulls{/number}","milestones_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/milestones{/number}","notifications_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/labels{/name}","releases_url":"https://api.github.com/repos/dragos/spark-streaming-testbed/releases{/id}","created_at":"2015-06-17T15:29:49Z","updated_at":"2015-06-17T15:29:49Z","pushed_at":"2015-06-19T16:50:29Z","git_url":"git://github.com/dragos/spark-streaming-testbed.git","ssh_url":"git@github.com:dragos/spark-streaming-testbed.git","clone_url":"https://github.com/dragos/spark-streaming-testbed.git","svn_url":"https://github.com/dragos/spark-streaming-testbed","homepage":null,"size":374,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"skyluc:master","ref":"master","sha":"59cc53016a190e08027173aafb22f3c4908c98d3","user":{"login":"skyluc","id":1098830,"avatar_url":"https://avatars.githubusercontent.com/u/1098830?v=3","gravatar_id":"","url":"https://api.github.com/users/skyluc","html_url":"https://github.com/skyluc","followers_url":"https://api.github.com/users/skyluc/followers","following_url":"https://api.github.com/users/skyluc/following{/other_user}","gists_url":"https://api.github.com/users/skyluc/gists{/gist_id}","starred_url":"https://api.github.com/users/skyluc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skyluc/subscriptions","organizations_url":"https://api.github.com/users/skyluc/orgs","repos_url":"https://api.github.com/users/skyluc/repos","events_url":"https://api.github.com/users/skyluc/events{/privacy}","received_events_url":"https://api.github.com/users/skyluc/received_events","type":"User","site_admin":false},"repo":{"id":35558092,"name":"spark-streaming-testbed","full_name":"skyluc/spark-streaming-testbed","owner":{"login":"skyluc","id":1098830,"avatar_url":"https://avatars.githubusercontent.com/u/1098830?v=3","gravatar_id":"","url":"https://api.github.com/users/skyluc","html_url":"https://github.com/skyluc","followers_url":"https://api.github.com/users/skyluc/followers","following_url":"https://api.github.com/users/skyluc/following{/other_user}","gists_url":"https://api.github.com/users/skyluc/gists{/gist_id}","starred_url":"https://api.github.com/users/skyluc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skyluc/subscriptions","organizations_url":"https://api.github.com/users/skyluc/orgs","repos_url":"https://api.github.com/users/skyluc/repos","events_url":"https://api.github.com/users/skyluc/events{/privacy}","received_events_url":"https://api.github.com/users/skyluc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/skyluc/spark-streaming-testbed","description":"","fork":false,"url":"https://api.github.com/repos/skyluc/spark-streaming-testbed","forks_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/forks","keys_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/keys{/key_id}","collaborators_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/teams","hooks_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/hooks","issue_events_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/issues/events{/number}","events_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/events","assignees_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/assignees{/user}","branches_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/branches{/branch}","tags_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/tags","blobs_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/git/refs{/sha}","trees_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/git/trees{/sha}","statuses_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/statuses/{sha}","languages_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/languages","stargazers_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/stargazers","contributors_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/contributors","subscribers_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/subscribers","subscription_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/subscription","commits_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/commits{/sha}","git_commits_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/git/commits{/sha}","comments_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/comments{/number}","issue_comment_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/issues/comments{/number}","contents_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/contents/{+path}","compare_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/compare/{base}...{head}","merges_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/merges","archive_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/downloads","issues_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/issues{/number}","pulls_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/pulls{/number}","milestones_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/milestones{/number}","notifications_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/labels{/name}","releases_url":"https://api.github.com/repos/skyluc/spark-streaming-testbed/releases{/id}","created_at":"2015-05-13T15:43:24Z","updated_at":"2015-05-13T15:43:57Z","pushed_at":"2015-06-20T08:43:37Z","git_url":"git://github.com/skyluc/spark-streaming-testbed.git","ssh_url":"git@github.com:skyluc/spark-streaming-testbed.git","clone_url":"https://github.com/skyluc/spark-streaming-testbed.git","svn_url":"https://github.com/skyluc/spark-streaming-testbed","homepage":null,"size":623,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/skyluc/spark-streaming-testbed/pulls/5"},"html":{"href":"https://github.com/skyluc/spark-streaming-testbed/pull/5"},"issue":{"href":"https://api.github.com/repos/skyluc/spark-streaming-testbed/issues/5"},"comments":{"href":"https://api.github.com/repos/skyluc/spark-streaming-testbed/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/skyluc/spark-streaming-testbed/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/skyluc/spark-streaming-testbed/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/skyluc/spark-streaming-testbed/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/skyluc/spark-streaming-testbed/statuses/b31cd56d6dbf159037d171e2405a42fca10f94c7"}}}}