{"action":"created","comment":{"url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/comments/43349488","id":43349488,"diff_hunk":"@@ -1,3 +1,27 @@\n from P2 import *\n \n # Your code here\n+import findspark\n+findspark.init('/home/raphael/spark')\n+\n+import pyspark\n+sc = pyspark.SparkContext(appName=\"myAppName\")\n+\n+T=sc.parallelize(np.array([k for k in range(2000)]))\n+U=sc.parallelize(np.array([k for k in range(2000)]))\n+mesh=T.cartesian(U)\n+#give key in a smart way so that partitionBy(100) take a better partition, it's a way to impose a new hash\n+meshKV = mesh.map(lambda point : (point[1]%100,point))\n+mesh2 = meshKV.partitionBy(100)\n+f=lambda x: x/500.-2\n+mandel = mesh2.map(lambda (K,V): (V,mandelbrot(f(V[0]),f(V[1]))))\n+#action against lazyness\n+print(mesh2.count(), mandel.count())\n+hist = sum_values_for_partitions(mandel)\n+load = hist.take(100)\n+\n+plt.hist(load,bins=10);\n+plt.ylabel(\"number of workers\")\n+plt.xlabel(\"number of operations\")\n+plt.title(\"histogram of the load balancing with optimization\")\n+plt.savefig(\"/home/raphael/cs205-homework/HW1/P2/P2b_hist.png\")","path":"HW1/P2/P2b.py","position":27,"original_position":27,"commit_id":"e21f5d8cec5afd230ade1b93e034e687f39ca4d8","original_commit_id":"e21f5d8cec5afd230ade1b93e034e687f39ca4d8","user":{"login":"zezhouliu","id":3782704,"avatar_url":"https://avatars.githubusercontent.com/u/3782704?v=3","gravatar_id":"","url":"https://api.github.com/users/zezhouliu","html_url":"https://github.com/zezhouliu","followers_url":"https://api.github.com/users/zezhouliu/followers","following_url":"https://api.github.com/users/zezhouliu/following{/other_user}","gists_url":"https://api.github.com/users/zezhouliu/gists{/gist_id}","starred_url":"https://api.github.com/users/zezhouliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zezhouliu/subscriptions","organizations_url":"https://api.github.com/users/zezhouliu/orgs","repos_url":"https://api.github.com/users/zezhouliu/repos","events_url":"https://api.github.com/users/zezhouliu/events{/privacy}","received_events_url":"https://api.github.com/users/zezhouliu/received_events","type":"User","site_admin":false},"body":"Your P2b Histogram does not look very optimized.  It seems that this is bimodal on both extremes, which implies that you might be able to redistribute the work somehow (high + low) to get more moderate balance","created_at":"2015-10-29T05:07:38Z","updated_at":"2015-10-29T05:07:38Z","html_url":"https://github.com/harvard-cs205/cs205-homework/pull/279#discussion_r43349488","pull_request_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/279","_links":{"self":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/comments/43349488"},"html":{"href":"https://github.com/harvard-cs205/cs205-homework/pull/279#discussion_r43349488"},"pull_request":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/279"}}},"pull_request":{"url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/279","id":48138494,"html_url":"https://github.com/harvard-cs205/cs205-homework/pull/279","diff_url":"https://github.com/harvard-cs205/cs205-homework/pull/279.diff","patch_url":"https://github.com/harvard-cs205/cs205-homework/pull/279.patch","issue_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/279","number":279,"state":"open","locked":false,"title":"hw1 submission","user":{"login":"rpestourie","id":5632523,"avatar_url":"https://avatars.githubusercontent.com/u/5632523?v=3","gravatar_id":"","url":"https://api.github.com/users/rpestourie","html_url":"https://github.com/rpestourie","followers_url":"https://api.github.com/users/rpestourie/followers","following_url":"https://api.github.com/users/rpestourie/following{/other_user}","gists_url":"https://api.github.com/users/rpestourie/gists{/gist_id}","starred_url":"https://api.github.com/users/rpestourie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rpestourie/subscriptions","organizations_url":"https://api.github.com/users/rpestourie/orgs","repos_url":"https://api.github.com/users/rpestourie/repos","events_url":"https://api.github.com/users/rpestourie/events{/privacy}","received_events_url":"https://api.github.com/users/rpestourie/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-19T23:09:12Z","updated_at":"2015-10-29T05:07:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2e8abde16c7c4a6de97269c89e73c1ec800bce99","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/279/commits","review_comments_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/279/comments","review_comment_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/279/comments","statuses_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/statuses/e21f5d8cec5afd230ade1b93e034e687f39ca4d8","head":{"label":"rpestourie:HW1","ref":"HW1","sha":"e21f5d8cec5afd230ade1b93e034e687f39ca4d8","user":{"login":"rpestourie","id":5632523,"avatar_url":"https://avatars.githubusercontent.com/u/5632523?v=3","gravatar_id":"","url":"https://api.github.com/users/rpestourie","html_url":"https://github.com/rpestourie","followers_url":"https://api.github.com/users/rpestourie/followers","following_url":"https://api.github.com/users/rpestourie/following{/other_user}","gists_url":"https://api.github.com/users/rpestourie/gists{/gist_id}","starred_url":"https://api.github.com/users/rpestourie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rpestourie/subscriptions","organizations_url":"https://api.github.com/users/rpestourie/orgs","repos_url":"https://api.github.com/users/rpestourie/repos","events_url":"https://api.github.com/users/rpestourie/events{/privacy}","received_events_url":"https://api.github.com/users/rpestourie/received_events","type":"User","site_admin":false},"repo":{"id":41938747,"name":"cs205-homework","full_name":"rpestourie/cs205-homework","owner":{"login":"rpestourie","id":5632523,"avatar_url":"https://avatars.githubusercontent.com/u/5632523?v=3","gravatar_id":"","url":"https://api.github.com/users/rpestourie","html_url":"https://github.com/rpestourie","followers_url":"https://api.github.com/users/rpestourie/followers","following_url":"https://api.github.com/users/rpestourie/following{/other_user}","gists_url":"https://api.github.com/users/rpestourie/gists{/gist_id}","starred_url":"https://api.github.com/users/rpestourie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rpestourie/subscriptions","organizations_url":"https://api.github.com/users/rpestourie/orgs","repos_url":"https://api.github.com/users/rpestourie/repos","events_url":"https://api.github.com/users/rpestourie/events{/privacy}","received_events_url":"https://api.github.com/users/rpestourie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rpestourie/cs205-homework","description":"","fork":true,"url":"https://api.github.com/repos/rpestourie/cs205-homework","forks_url":"https://api.github.com/repos/rpestourie/cs205-homework/forks","keys_url":"https://api.github.com/repos/rpestourie/cs205-homework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rpestourie/cs205-homework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rpestourie/cs205-homework/teams","hooks_url":"https://api.github.com/repos/rpestourie/cs205-homework/hooks","issue_events_url":"https://api.github.com/repos/rpestourie/cs205-homework/issues/events{/number}","events_url":"https://api.github.com/repos/rpestourie/cs205-homework/events","assignees_url":"https://api.github.com/repos/rpestourie/cs205-homework/assignees{/user}","branches_url":"https://api.github.com/repos/rpestourie/cs205-homework/branches{/branch}","tags_url":"https://api.github.com/repos/rpestourie/cs205-homework/tags","blobs_url":"https://api.github.com/repos/rpestourie/cs205-homework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rpestourie/cs205-homework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rpestourie/cs205-homework/git/refs{/sha}","trees_url":"https://api.github.com/repos/rpestourie/cs205-homework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rpestourie/cs205-homework/statuses/{sha}","languages_url":"https://api.github.com/repos/rpestourie/cs205-homework/languages","stargazers_url":"https://api.github.com/repos/rpestourie/cs205-homework/stargazers","contributors_url":"https://api.github.com/repos/rpestourie/cs205-homework/contributors","subscribers_url":"https://api.github.com/repos/rpestourie/cs205-homework/subscribers","subscription_url":"https://api.github.com/repos/rpestourie/cs205-homework/subscription","commits_url":"https://api.github.com/repos/rpestourie/cs205-homework/commits{/sha}","git_commits_url":"https://api.github.com/repos/rpestourie/cs205-homework/git/commits{/sha}","comments_url":"https://api.github.com/repos/rpestourie/cs205-homework/comments{/number}","issue_comment_url":"https://api.github.com/repos/rpestourie/cs205-homework/issues/comments{/number}","contents_url":"https://api.github.com/repos/rpestourie/cs205-homework/contents/{+path}","compare_url":"https://api.github.com/repos/rpestourie/cs205-homework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rpestourie/cs205-homework/merges","archive_url":"https://api.github.com/repos/rpestourie/cs205-homework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rpestourie/cs205-homework/downloads","issues_url":"https://api.github.com/repos/rpestourie/cs205-homework/issues{/number}","pulls_url":"https://api.github.com/repos/rpestourie/cs205-homework/pulls{/number}","milestones_url":"https://api.github.com/repos/rpestourie/cs205-homework/milestones{/number}","notifications_url":"https://api.github.com/repos/rpestourie/cs205-homework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rpestourie/cs205-homework/labels{/name}","releases_url":"https://api.github.com/repos/rpestourie/cs205-homework/releases{/id}","created_at":"2015-09-04T21:33:46Z","updated_at":"2015-09-16T20:13:05Z","pushed_at":"2015-10-05T03:35:38Z","git_url":"git://github.com/rpestourie/cs205-homework.git","ssh_url":"git@github.com:rpestourie/cs205-homework.git","clone_url":"https://github.com/rpestourie/cs205-homework.git","svn_url":"https://github.com/rpestourie/cs205-homework","homepage":null,"size":240,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"harvard-cs205:master","ref":"master","sha":"f1c0ab77bd14f0cbe6163dff4a05c22d0d8e35d3","user":{"login":"harvard-cs205","id":13456002,"avatar_url":"https://avatars.githubusercontent.com/u/13456002?v=3","gravatar_id":"","url":"https://api.github.com/users/harvard-cs205","html_url":"https://github.com/harvard-cs205","followers_url":"https://api.github.com/users/harvard-cs205/followers","following_url":"https://api.github.com/users/harvard-cs205/following{/other_user}","gists_url":"https://api.github.com/users/harvard-cs205/gists{/gist_id}","starred_url":"https://api.github.com/users/harvard-cs205/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harvard-cs205/subscriptions","organizations_url":"https://api.github.com/users/harvard-cs205/orgs","repos_url":"https://api.github.com/users/harvard-cs205/repos","events_url":"https://api.github.com/users/harvard-cs205/events{/privacy}","received_events_url":"https://api.github.com/users/harvard-cs205/received_events","type":"Organization","site_admin":false},"repo":{"id":40614104,"name":"cs205-homework","full_name":"harvard-cs205/cs205-homework","owner":{"login":"harvard-cs205","id":13456002,"avatar_url":"https://avatars.githubusercontent.com/u/13456002?v=3","gravatar_id":"","url":"https://api.github.com/users/harvard-cs205","html_url":"https://github.com/harvard-cs205","followers_url":"https://api.github.com/users/harvard-cs205/followers","following_url":"https://api.github.com/users/harvard-cs205/following{/other_user}","gists_url":"https://api.github.com/users/harvard-cs205/gists{/gist_id}","starred_url":"https://api.github.com/users/harvard-cs205/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harvard-cs205/subscriptions","organizations_url":"https://api.github.com/users/harvard-cs205/orgs","repos_url":"https://api.github.com/users/harvard-cs205/repos","events_url":"https://api.github.com/users/harvard-cs205/events{/privacy}","received_events_url":"https://api.github.com/users/harvard-cs205/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/harvard-cs205/cs205-homework","description":"","fork":false,"url":"https://api.github.com/repos/harvard-cs205/cs205-homework","forks_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/forks","keys_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/teams","hooks_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/hooks","issue_events_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/events{/number}","events_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/events","assignees_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/assignees{/user}","branches_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/branches{/branch}","tags_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/tags","blobs_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/git/refs{/sha}","trees_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/statuses/{sha}","languages_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/languages","stargazers_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/stargazers","contributors_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/contributors","subscribers_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/subscribers","subscription_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/subscription","commits_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/commits{/sha}","git_commits_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/git/commits{/sha}","comments_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/comments{/number}","issue_comment_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/comments{/number}","contents_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/contents/{+path}","compare_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/merges","archive_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/downloads","issues_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues{/number}","pulls_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls{/number}","milestones_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/milestones{/number}","notifications_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/labels{/name}","releases_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/releases{/id}","created_at":"2015-08-12T17:18:15Z","updated_at":"2015-10-21T19:21:28Z","pushed_at":"2015-10-28T16:58:02Z","git_url":"git://github.com/harvard-cs205/cs205-homework.git","ssh_url":"git@github.com:harvard-cs205/cs205-homework.git","clone_url":"https://github.com/harvard-cs205/cs205-homework.git","svn_url":"https://github.com/harvard-cs205/cs205-homework","homepage":null,"size":83848,"stargazers_count":5,"watchers_count":5,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":99,"mirror_url":null,"open_issues_count":268,"forks":99,"open_issues":268,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/279"},"html":{"href":"https://github.com/harvard-cs205/cs205-homework/pull/279"},"issue":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/279"},"comments":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/279/comments"},"review_comments":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/279/comments"},"review_comment":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/279/commits"},"statuses":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/statuses/e21f5d8cec5afd230ade1b93e034e687f39ca4d8"}}}}