{"action":"created","comment":{"url":"https://api.github.com/repos/coala-analyzer/cEPs/pulls/comments/72886003","id":72886003,"diff_hunk":"@@ -0,0 +1,402 @@\n+# Next Gen Bear Design\n+\n+| Metadata     |                                         |\n+| ------------ |-----------------------------------------|\n+| cEP          | 2                                       |\n+| Version      | 0.1                                     |\n+| Title        | Next gen bear design                    |\n+| Authors      | Udayan Tandon <udayan12167@iiitd.ac.in> |\n+| Status       | Proposed                                |\n+| Type         | Process                                 |\n+\n+# Abstract\n+\n+This document describes how the next generation bears will be designed and\n+implemented.\n+\n+This cEP describes a new implementation of bears in coala which should make\n+ them simpler and make their design more intuitive and better.\n+\n+# Introduction\n+\n+Currently the bear design is clunky and bad. The current design makes global\n+bears dependant on local bears through it's queuing mechanism. It uses\n+communication signals over a queue to indicate that global bears are done with\n+their execution and local bears can begin. The queueing mechanism doesn't work\n+very well as it sometimes has synchronization problems. Also if local bears\n+fail to run it stalls the global bears. Also we have a permanent logger thread.\n+An extra logger thread consumes time and resources of the system which we can\n+avoid.\n+\n+The new proposal aims to eliminate the use of the queuing control signals.\n+Utilising asynchronous I/O and process pool to generate results from  the\n+bears. No longer will the local bears be dependent on global bears to finish.\n+The logging will also be handled by the main thread itself instead of\n+utilising an extra thread.\n+\n+# Proposed Change\n+\n+Here is the detailed implementation stepwise:\n+\n+1. A `ProcessPoolExecutor` is created with the maximum number of processes\n+your CPU can run in parallel.\n+2. We proceed with getting an asynchronous event loop. This asynchronous event\n+loop creates `Concurrent.Futures` for tasks and schedules them to the process\n+pool.\n+3. Each task is given a callback when it has a result ready. This callback is responsible for processing the result accordingly.\n+3. The `Bear` class will get two new methods. `execute_task()` and\n+`generate_tasks()`.\n+    * The `generate_tasks()` is resposible for generating the correct\n+    arguments for the upcoming tasks.\n+    * The `execute_task()` method is scheduled by the event loop to the\n+    process pool using the arguments from the `generate_tasks()` method.\n+3. Each bear will generate the following type of tasks:\n+    * Global bears fire tasks that process all files.\n+    * Local bears fire tasks for each individual file.\n+    * Arbitrary tasks such as dependency bears or other tasks are also\n+    possible.\n+4. A bear that has dependencies will only be scheduled to the process pool once all its dependencies have been resolved. It's done in the following way:\n+    * It's checked if the bear has some dependencies.\n+    * If they haven't been resolved the bear is not scheduled.\n+    * As soon as the dependencies are resolved for a bear it is removed from the dependency dictionary and scheduled to the `ProcessPoolExecutor`.\n+5. A special purpose `Dependencies` class will be introduced to do the above\n+mentioned task. This will be responsible for keeping track of dependencies.\n+Whenever a bear completes it will be removed from the dependency class.\n+6. When all the tasks are done the event loop is stopped and closed.\n+7. You would not need to change any bears because coala will handle the\n+backwards compatibility. There will be new versions of `LocalBear` and\n+`GlobalBear` and will be called `FileWiseBear` and `ProjectWideBear`\n+respectively.\n+\n+# The File Proxy\n+\n+With the new bear design we are also moving to a new wrapper object to wrap\n+every file. This object will also contain some metadata such as the filename\n+of the file. The file proxy is an object that contains properties that are\n+cached and passed around processes.\n+\n+What it will store:\n+    * The filename, this is the starting point for every other attribute.\n+    * The content of the file as a string.\n+    * The content of the file, line-splitted","path":"cEP-0002.md","position":81,"original_position":81,"commit_id":"8f970dce75e07221c9b15ed98043da9d5aa0118e","original_commit_id":"8f970dce75e07221c9b15ed98043da9d5aa0118e","user":{"login":"tushar-rishav","id":7397433,"avatar_url":"https://avatars.githubusercontent.com/u/7397433?v=3","gravatar_id":"","url":"https://api.github.com/users/tushar-rishav","html_url":"https://github.com/tushar-rishav","followers_url":"https://api.github.com/users/tushar-rishav/followers","following_url":"https://api.github.com/users/tushar-rishav/following{/other_user}","gists_url":"https://api.github.com/users/tushar-rishav/gists{/gist_id}","starred_url":"https://api.github.com/users/tushar-rishav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tushar-rishav/subscriptions","organizations_url":"https://api.github.com/users/tushar-rishav/orgs","repos_url":"https://api.github.com/users/tushar-rishav/repos","events_url":"https://api.github.com/users/tushar-rishav/events{/privacy}","received_events_url":"https://api.github.com/users/tushar-rishav/received_events","type":"User","site_admin":false},"body":"I guess it's like space vs time. ","created_at":"2016-07-30T11:23:11Z","updated_at":"2016-07-30T11:23:11Z","html_url":"https://github.com/coala-analyzer/cEPs/pull/7#discussion_r72886003","pull_request_url":"https://api.github.com/repos/coala-analyzer/cEPs/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/coala-analyzer/cEPs/pulls/comments/72886003"},"html":{"href":"https://github.com/coala-analyzer/cEPs/pull/7#discussion_r72886003"},"pull_request":{"href":"https://api.github.com/repos/coala-analyzer/cEPs/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/coala-analyzer/cEPs/pulls/7","id":72636696,"html_url":"https://github.com/coala-analyzer/cEPs/pull/7","diff_url":"https://github.com/coala-analyzer/cEPs/pull/7.diff","patch_url":"https://github.com/coala-analyzer/cEPs/pull/7.patch","issue_url":"https://api.github.com/repos/coala-analyzer/cEPs/issues/7","number":7,"state":"open","locked":false,"title":"cEP-2: Next generation bear design","user":{"login":"Udayan12167","id":6421568,"avatar_url":"https://avatars.githubusercontent.com/u/6421568?v=3","gravatar_id":"","url":"https://api.github.com/users/Udayan12167","html_url":"https://github.com/Udayan12167","followers_url":"https://api.github.com/users/Udayan12167/followers","following_url":"https://api.github.com/users/Udayan12167/following{/other_user}","gists_url":"https://api.github.com/users/Udayan12167/gists{/gist_id}","starred_url":"https://api.github.com/users/Udayan12167/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Udayan12167/subscriptions","organizations_url":"https://api.github.com/users/Udayan12167/orgs","repos_url":"https://api.github.com/users/Udayan12167/repos","events_url":"https://api.github.com/users/Udayan12167/events{/privacy}","received_events_url":"https://api.github.com/users/Udayan12167/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-05T18:35:04Z","updated_at":"2016-07-30T11:23:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0ba3a7891dce43ab7b85c028c74e1a7c6097e78a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/coala-analyzer/cEPs/pulls/7/commits","review_comments_url":"https://api.github.com/repos/coala-analyzer/cEPs/pulls/7/comments","review_comment_url":"https://api.github.com/repos/coala-analyzer/cEPs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coala-analyzer/cEPs/issues/7/comments","statuses_url":"https://api.github.com/repos/coala-analyzer/cEPs/statuses/8f970dce75e07221c9b15ed98043da9d5aa0118e","head":{"label":"coala-analyzer:cEP2","ref":"cEP2","sha":"8f970dce75e07221c9b15ed98043da9d5aa0118e","user":{"login":"coala-analyzer","id":10620750,"avatar_url":"https://avatars.githubusercontent.com/u/10620750?v=3","gravatar_id":"","url":"https://api.github.com/users/coala-analyzer","html_url":"https://github.com/coala-analyzer","followers_url":"https://api.github.com/users/coala-analyzer/followers","following_url":"https://api.github.com/users/coala-analyzer/following{/other_user}","gists_url":"https://api.github.com/users/coala-analyzer/gists{/gist_id}","starred_url":"https://api.github.com/users/coala-analyzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coala-analyzer/subscriptions","organizations_url":"https://api.github.com/users/coala-analyzer/orgs","repos_url":"https://api.github.com/users/coala-analyzer/repos","events_url":"https://api.github.com/users/coala-analyzer/events{/privacy}","received_events_url":"https://api.github.com/users/coala-analyzer/received_events","type":"Organization","site_admin":false},"repo":{"id":60130869,"name":"cEPs","full_name":"coala-analyzer/cEPs","owner":{"login":"coala-analyzer","id":10620750,"avatar_url":"https://avatars.githubusercontent.com/u/10620750?v=3","gravatar_id":"","url":"https://api.github.com/users/coala-analyzer","html_url":"https://github.com/coala-analyzer","followers_url":"https://api.github.com/users/coala-analyzer/followers","following_url":"https://api.github.com/users/coala-analyzer/following{/other_user}","gists_url":"https://api.github.com/users/coala-analyzer/gists{/gist_id}","starred_url":"https://api.github.com/users/coala-analyzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coala-analyzer/subscriptions","organizations_url":"https://api.github.com/users/coala-analyzer/orgs","repos_url":"https://api.github.com/users/coala-analyzer/repos","events_url":"https://api.github.com/users/coala-analyzer/events{/privacy}","received_events_url":"https://api.github.com/users/coala-analyzer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coala-analyzer/cEPs","description":"coala Enhancement Proposals","fork":false,"url":"https://api.github.com/repos/coala-analyzer/cEPs","forks_url":"https://api.github.com/repos/coala-analyzer/cEPs/forks","keys_url":"https://api.github.com/repos/coala-analyzer/cEPs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coala-analyzer/cEPs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coala-analyzer/cEPs/teams","hooks_url":"https://api.github.com/repos/coala-analyzer/cEPs/hooks","issue_events_url":"https://api.github.com/repos/coala-analyzer/cEPs/issues/events{/number}","events_url":"https://api.github.com/repos/coala-analyzer/cEPs/events","assignees_url":"https://api.github.com/repos/coala-analyzer/cEPs/assignees{/user}","branches_url":"https://api.github.com/repos/coala-analyzer/cEPs/branches{/branch}","tags_url":"https://api.github.com/repos/coala-analyzer/cEPs/tags","blobs_url":"https://api.github.com/repos/coala-analyzer/cEPs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coala-analyzer/cEPs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coala-analyzer/cEPs/git/refs{/sha}","trees_url":"https://api.github.com/repos/coala-analyzer/cEPs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coala-analyzer/cEPs/statuses/{sha}","languages_url":"https://api.github.com/repos/coala-analyzer/cEPs/languages","stargazers_url":"https://api.github.com/repos/coala-analyzer/cEPs/stargazers","contributors_url":"https://api.github.com/repos/coala-analyzer/cEPs/contributors","subscribers_url":"https://api.github.com/repos/coala-analyzer/cEPs/subscribers","subscription_url":"https://api.github.com/repos/coala-analyzer/cEPs/subscription","commits_url":"https://api.github.com/repos/coala-analyzer/cEPs/commits{/sha}","git_commits_url":"https://api.github.com/repos/coala-analyzer/cEPs/git/commits{/sha}","comments_url":"https://api.github.com/repos/coala-analyzer/cEPs/comments{/number}","issue_comment_url":"https://api.github.com/repos/coala-analyzer/cEPs/issues/comments{/number}","contents_url":"https://api.github.com/repos/coala-analyzer/cEPs/contents/{+path}","compare_url":"https://api.github.com/repos/coala-analyzer/cEPs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coala-analyzer/cEPs/merges","archive_url":"https://api.github.com/repos/coala-analyzer/cEPs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coala-analyzer/cEPs/downloads","issues_url":"https://api.github.com/repos/coala-analyzer/cEPs/issues{/number}","pulls_url":"https://api.github.com/repos/coala-analyzer/cEPs/pulls{/number}","milestones_url":"https://api.github.com/repos/coala-analyzer/cEPs/milestones{/number}","notifications_url":"https://api.github.com/repos/coala-analyzer/cEPs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coala-analyzer/cEPs/labels{/name}","releases_url":"https://api.github.com/repos/coala-analyzer/cEPs/releases{/id}","deployments_url":"https://api.github.com/repos/coala-analyzer/cEPs/deployments","created_at":"2016-05-31T23:37:51Z","updated_at":"2016-07-30T11:17:35Z","pushed_at":"2016-07-30T10:26:14Z","git_url":"git://github.com/coala-analyzer/cEPs.git","ssh_url":"git@github.com:coala-analyzer/cEPs.git","clone_url":"https://github.com/coala-analyzer/cEPs.git","svn_url":"https://github.com/coala-analyzer/cEPs","homepage":null,"size":14,"stargazers_count":2,"watchers_count":2,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":2,"default_branch":"master"}},"base":{"label":"coala-analyzer:master","ref":"master","sha":"032cbf20e8fea372c22b1c1ab2085194333a3f44","user":{"login":"coala-analyzer","id":10620750,"avatar_url":"https://avatars.githubusercontent.com/u/10620750?v=3","gravatar_id":"","url":"https://api.github.com/users/coala-analyzer","html_url":"https://github.com/coala-analyzer","followers_url":"https://api.github.com/users/coala-analyzer/followers","following_url":"https://api.github.com/users/coala-analyzer/following{/other_user}","gists_url":"https://api.github.com/users/coala-analyzer/gists{/gist_id}","starred_url":"https://api.github.com/users/coala-analyzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coala-analyzer/subscriptions","organizations_url":"https://api.github.com/users/coala-analyzer/orgs","repos_url":"https://api.github.com/users/coala-analyzer/repos","events_url":"https://api.github.com/users/coala-analyzer/events{/privacy}","received_events_url":"https://api.github.com/users/coala-analyzer/received_events","type":"Organization","site_admin":false},"repo":{"id":60130869,"name":"cEPs","full_name":"coala-analyzer/cEPs","owner":{"login":"coala-analyzer","id":10620750,"avatar_url":"https://avatars.githubusercontent.com/u/10620750?v=3","gravatar_id":"","url":"https://api.github.com/users/coala-analyzer","html_url":"https://github.com/coala-analyzer","followers_url":"https://api.github.com/users/coala-analyzer/followers","following_url":"https://api.github.com/users/coala-analyzer/following{/other_user}","gists_url":"https://api.github.com/users/coala-analyzer/gists{/gist_id}","starred_url":"https://api.github.com/users/coala-analyzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coala-analyzer/subscriptions","organizations_url":"https://api.github.com/users/coala-analyzer/orgs","repos_url":"https://api.github.com/users/coala-analyzer/repos","events_url":"https://api.github.com/users/coala-analyzer/events{/privacy}","received_events_url":"https://api.github.com/users/coala-analyzer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coala-analyzer/cEPs","description":"coala Enhancement Proposals","fork":false,"url":"https://api.github.com/repos/coala-analyzer/cEPs","forks_url":"https://api.github.com/repos/coala-analyzer/cEPs/forks","keys_url":"https://api.github.com/repos/coala-analyzer/cEPs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coala-analyzer/cEPs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coala-analyzer/cEPs/teams","hooks_url":"https://api.github.com/repos/coala-analyzer/cEPs/hooks","issue_events_url":"https://api.github.com/repos/coala-analyzer/cEPs/issues/events{/number}","events_url":"https://api.github.com/repos/coala-analyzer/cEPs/events","assignees_url":"https://api.github.com/repos/coala-analyzer/cEPs/assignees{/user}","branches_url":"https://api.github.com/repos/coala-analyzer/cEPs/branches{/branch}","tags_url":"https://api.github.com/repos/coala-analyzer/cEPs/tags","blobs_url":"https://api.github.com/repos/coala-analyzer/cEPs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coala-analyzer/cEPs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coala-analyzer/cEPs/git/refs{/sha}","trees_url":"https://api.github.com/repos/coala-analyzer/cEPs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coala-analyzer/cEPs/statuses/{sha}","languages_url":"https://api.github.com/repos/coala-analyzer/cEPs/languages","stargazers_url":"https://api.github.com/repos/coala-analyzer/cEPs/stargazers","contributors_url":"https://api.github.com/repos/coala-analyzer/cEPs/contributors","subscribers_url":"https://api.github.com/repos/coala-analyzer/cEPs/subscribers","subscription_url":"https://api.github.com/repos/coala-analyzer/cEPs/subscription","commits_url":"https://api.github.com/repos/coala-analyzer/cEPs/commits{/sha}","git_commits_url":"https://api.github.com/repos/coala-analyzer/cEPs/git/commits{/sha}","comments_url":"https://api.github.com/repos/coala-analyzer/cEPs/comments{/number}","issue_comment_url":"https://api.github.com/repos/coala-analyzer/cEPs/issues/comments{/number}","contents_url":"https://api.github.com/repos/coala-analyzer/cEPs/contents/{+path}","compare_url":"https://api.github.com/repos/coala-analyzer/cEPs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coala-analyzer/cEPs/merges","archive_url":"https://api.github.com/repos/coala-analyzer/cEPs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coala-analyzer/cEPs/downloads","issues_url":"https://api.github.com/repos/coala-analyzer/cEPs/issues{/number}","pulls_url":"https://api.github.com/repos/coala-analyzer/cEPs/pulls{/number}","milestones_url":"https://api.github.com/repos/coala-analyzer/cEPs/milestones{/number}","notifications_url":"https://api.github.com/repos/coala-analyzer/cEPs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coala-analyzer/cEPs/labels{/name}","releases_url":"https://api.github.com/repos/coala-analyzer/cEPs/releases{/id}","deployments_url":"https://api.github.com/repos/coala-analyzer/cEPs/deployments","created_at":"2016-05-31T23:37:51Z","updated_at":"2016-07-30T11:17:35Z","pushed_at":"2016-07-30T10:26:14Z","git_url":"git://github.com/coala-analyzer/cEPs.git","ssh_url":"git@github.com:coala-analyzer/cEPs.git","clone_url":"https://github.com/coala-analyzer/cEPs.git","svn_url":"https://github.com/coala-analyzer/cEPs","homepage":null,"size":14,"stargazers_count":2,"watchers_count":2,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coala-analyzer/cEPs/pulls/7"},"html":{"href":"https://github.com/coala-analyzer/cEPs/pull/7"},"issue":{"href":"https://api.github.com/repos/coala-analyzer/cEPs/issues/7"},"comments":{"href":"https://api.github.com/repos/coala-analyzer/cEPs/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/coala-analyzer/cEPs/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/coala-analyzer/cEPs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coala-analyzer/cEPs/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/coala-analyzer/cEPs/statuses/8f970dce75e07221c9b15ed98043da9d5aa0118e"}}}}
{"actor":{"display_login":"tushar-rishav"}}