{"action":"created","comment":{"url":"https://api.github.com/repos/lasp-lang/lasp/pulls/comments/72827531","id":72827531,"diff_hunk":"@@ -176,6 +256,25 @@ handle_call({export_dot, Path}, _From, #state{dag=Dag}=State) ->\n handle_call(get_process_map, _From, #state{process_map=PM}=State) ->\n     {reply, {ok, dict:to_list(PM)}, State};\n \n+handle_call(contract, _From, #state{dag=Dag}=State) ->\n+    lists:foreach(fun(P) ->\n+        contract(Dag, P)\n+    end, contraction_paths(Dag)),\n+    {reply, ok, State};\n+\n+handle_call({cleave, Vertex}, _From, #state{dag=Dag, optimized_map=OptMap}=State) ->\n+    cleave_if_contracted(Dag, Vertex, OptMap),\n+    {reply, ok, State};\n+\n+handle_call(cleave_all, _From, #state{optimized_map=OptMap}=State) ->\n+    lists:foreach(fun(Id) ->\n+        {Pid, _, _} = dict:fetch(Id, OptMap),\n+        spawn_link(fun() ->\n+            lasp_process_sup:terminate_child(lasp_process_sup, Pid)","path":"src/lasp_dependence_dag.erl","position":216,"original_position":216,"commit_id":"448762a30406cc9279ee77562736b1ce5f279b34","original_commit_id":"448762a30406cc9279ee77562736b1ce5f279b34","user":{"login":"ergl","id":3091816,"avatar_url":"https://avatars.githubusercontent.com/u/3091816?v=3","gravatar_id":"","url":"https://api.github.com/users/ergl","html_url":"https://github.com/ergl","followers_url":"https://api.github.com/users/ergl/followers","following_url":"https://api.github.com/users/ergl/following{/other_user}","gists_url":"https://api.github.com/users/ergl/gists{/gist_id}","starred_url":"https://api.github.com/users/ergl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ergl/subscriptions","organizations_url":"https://api.github.com/users/ergl/orgs","repos_url":"https://api.github.com/users/ergl/repos","events_url":"https://api.github.com/users/ergl/events{/privacy}","received_events_url":"https://api.github.com/users/ergl/received_events","type":"User","site_admin":false},"body":"To undo the optimization for a given path, it kills the process that connects its endpoints.\r\n\r\nWhen any of those processes are killed by the superviros, the cleaving process is automatically started.\r\n\r\nYou can see the handler for that in [`handle_info`](https://github.com/ergl/lasp/blob/contraction/src/lasp_dependence_dag.erl#L426) and the actual cleaving in [`cleave_associated_path`](https://github.com/ergl/lasp/blob/contraction/src/lasp_dependence_dag.erl#L832).","created_at":"2016-07-29T17:13:25Z","updated_at":"2016-07-29T17:13:25Z","html_url":"https://github.com/lasp-lang/lasp/pull/138#discussion_r72827531","pull_request_url":"https://api.github.com/repos/lasp-lang/lasp/pulls/138","_links":{"self":{"href":"https://api.github.com/repos/lasp-lang/lasp/pulls/comments/72827531"},"html":{"href":"https://github.com/lasp-lang/lasp/pull/138#discussion_r72827531"},"pull_request":{"href":"https://api.github.com/repos/lasp-lang/lasp/pulls/138"}}},"pull_request":{"url":"https://api.github.com/repos/lasp-lang/lasp/pulls/138","id":78571180,"html_url":"https://github.com/lasp-lang/lasp/pull/138","diff_url":"https://github.com/lasp-lang/lasp/pull/138.diff","patch_url":"https://github.com/lasp-lang/lasp/pull/138.patch","issue_url":"https://api.github.com/repos/lasp-lang/lasp/issues/138","number":138,"state":"open","locked":false,"title":"Dag path contraction (wip)","user":{"login":"ergl","id":3091816,"avatar_url":"https://avatars.githubusercontent.com/u/3091816?v=3","gravatar_id":"","url":"https://api.github.com/users/ergl","html_url":"https://github.com/ergl","followers_url":"https://api.github.com/users/ergl/followers","following_url":"https://api.github.com/users/ergl/following{/other_user}","gists_url":"https://api.github.com/users/ergl/gists{/gist_id}","starred_url":"https://api.github.com/users/ergl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ergl/subscriptions","organizations_url":"https://api.github.com/users/ergl/orgs","repos_url":"https://api.github.com/users/ergl/repos","events_url":"https://api.github.com/users/ergl/events{/privacy}","received_events_url":"https://api.github.com/users/ergl/received_events","type":"User","site_admin":false},"body":"This PR implements path contraction and cleaving as a way to remove intermediate vertices in the graph.\r\n\r\n#### What's working:\r\n\r\n- Detection of suitable paths to be contracted.\r\n\r\n- Explicit optimization passes (calling `lasp_dependence_dag:contract()` will contract all suitable paths in the graph).\r\n\r\n- Automatic cleaving based on vertex access behaviours. (Creating new edges involving removed vertices undoes any optimizations involving that vertex).\r\n\r\n- Cycle detection on removed edges (`lasp_dependence_dag:will_form_cycle` will detect cycles even if the vertices were removed during a contraction in the graph).\r\n\r\n- Autoupdating of vertex tags on process restart.\r\n\r\n#### To be implemented:\r\n\r\n- [X] ~~Removed vertices hold a reference to the Pid of the process that connects endpoints in the contracted path. This reference is not updated if that process is restarted. This means that if that process is restarted, any future attempts to cleave the vertices in that path will fail.~~\r\n\r\n- [ ] Some parts of the path contraction must be implemented in an asynchronous manner (the process that connects the endpoints must be succesfully started before tagging the vertices and removing the other edges). This means that some parts of the graph may have changed between some steps. Need to test this part more, and perform some consistency checking \r\non those paths (if they are still suitable for contraction).\r\n\r\n- [ ] Automatic optimization passes. Think about how often optimization passes should occur.\r\n\r\n#### Issues\r\n\r\n- Since both creating and stopping processes are asynchronous in nature, reads and queries may be able to get old data from a removed vertex before the cleaving finishes. This is not a problem with binds or updates since downstream values will eventually get the new value once the cleaving finishes.\r\n","created_at":"2016-07-23T12:31:14Z","updated_at":"2016-07-29T17:13:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cd740ff11a352d879918fc4ca83ee257ae008547","assignee":{"login":"cmeiklejohn","id":44939,"avatar_url":"https://avatars.githubusercontent.com/u/44939?v=3","gravatar_id":"","url":"https://api.github.com/users/cmeiklejohn","html_url":"https://github.com/cmeiklejohn","followers_url":"https://api.github.com/users/cmeiklejohn/followers","following_url":"https://api.github.com/users/cmeiklejohn/following{/other_user}","gists_url":"https://api.github.com/users/cmeiklejohn/gists{/gist_id}","starred_url":"https://api.github.com/users/cmeiklejohn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmeiklejohn/subscriptions","organizations_url":"https://api.github.com/users/cmeiklejohn/orgs","repos_url":"https://api.github.com/users/cmeiklejohn/repos","events_url":"https://api.github.com/users/cmeiklejohn/events{/privacy}","received_events_url":"https://api.github.com/users/cmeiklejohn/received_events","type":"User","site_admin":false},"assignees":[{"login":"cmeiklejohn","id":44939,"avatar_url":"https://avatars.githubusercontent.com/u/44939?v=3","gravatar_id":"","url":"https://api.github.com/users/cmeiklejohn","html_url":"https://github.com/cmeiklejohn","followers_url":"https://api.github.com/users/cmeiklejohn/followers","following_url":"https://api.github.com/users/cmeiklejohn/following{/other_user}","gists_url":"https://api.github.com/users/cmeiklejohn/gists{/gist_id}","starred_url":"https://api.github.com/users/cmeiklejohn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmeiklejohn/subscriptions","organizations_url":"https://api.github.com/users/cmeiklejohn/orgs","repos_url":"https://api.github.com/users/cmeiklejohn/repos","events_url":"https://api.github.com/users/cmeiklejohn/events{/privacy}","received_events_url":"https://api.github.com/users/cmeiklejohn/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/lasp-lang/lasp/pulls/138/commits","review_comments_url":"https://api.github.com/repos/lasp-lang/lasp/pulls/138/comments","review_comment_url":"https://api.github.com/repos/lasp-lang/lasp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lasp-lang/lasp/issues/138/comments","statuses_url":"https://api.github.com/repos/lasp-lang/lasp/statuses/448762a30406cc9279ee77562736b1ce5f279b34","head":{"label":"ergl:contraction","ref":"contraction","sha":"448762a30406cc9279ee77562736b1ce5f279b34","user":{"login":"ergl","id":3091816,"avatar_url":"https://avatars.githubusercontent.com/u/3091816?v=3","gravatar_id":"","url":"https://api.github.com/users/ergl","html_url":"https://github.com/ergl","followers_url":"https://api.github.com/users/ergl/followers","following_url":"https://api.github.com/users/ergl/following{/other_user}","gists_url":"https://api.github.com/users/ergl/gists{/gist_id}","starred_url":"https://api.github.com/users/ergl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ergl/subscriptions","organizations_url":"https://api.github.com/users/ergl/orgs","repos_url":"https://api.github.com/users/ergl/repos","events_url":"https://api.github.com/users/ergl/events{/privacy}","received_events_url":"https://api.github.com/users/ergl/received_events","type":"User","site_admin":false},"repo":{"id":58040177,"name":"lasp","full_name":"ergl/lasp","owner":{"login":"ergl","id":3091816,"avatar_url":"https://avatars.githubusercontent.com/u/3091816?v=3","gravatar_id":"","url":"https://api.github.com/users/ergl","html_url":"https://github.com/ergl","followers_url":"https://api.github.com/users/ergl/followers","following_url":"https://api.github.com/users/ergl/following{/other_user}","gists_url":"https://api.github.com/users/ergl/gists{/gist_id}","starred_url":"https://api.github.com/users/ergl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ergl/subscriptions","organizations_url":"https://api.github.com/users/ergl/orgs","repos_url":"https://api.github.com/users/ergl/repos","events_url":"https://api.github.com/users/ergl/events{/privacy}","received_events_url":"https://api.github.com/users/ergl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ergl/lasp","description":"Prototype implementation of Lasp in Erlang.","fork":true,"url":"https://api.github.com/repos/ergl/lasp","forks_url":"https://api.github.com/repos/ergl/lasp/forks","keys_url":"https://api.github.com/repos/ergl/lasp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ergl/lasp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ergl/lasp/teams","hooks_url":"https://api.github.com/repos/ergl/lasp/hooks","issue_events_url":"https://api.github.com/repos/ergl/lasp/issues/events{/number}","events_url":"https://api.github.com/repos/ergl/lasp/events","assignees_url":"https://api.github.com/repos/ergl/lasp/assignees{/user}","branches_url":"https://api.github.com/repos/ergl/lasp/branches{/branch}","tags_url":"https://api.github.com/repos/ergl/lasp/tags","blobs_url":"https://api.github.com/repos/ergl/lasp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ergl/lasp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ergl/lasp/git/refs{/sha}","trees_url":"https://api.github.com/repos/ergl/lasp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ergl/lasp/statuses/{sha}","languages_url":"https://api.github.com/repos/ergl/lasp/languages","stargazers_url":"https://api.github.com/repos/ergl/lasp/stargazers","contributors_url":"https://api.github.com/repos/ergl/lasp/contributors","subscribers_url":"https://api.github.com/repos/ergl/lasp/subscribers","subscription_url":"https://api.github.com/repos/ergl/lasp/subscription","commits_url":"https://api.github.com/repos/ergl/lasp/commits{/sha}","git_commits_url":"https://api.github.com/repos/ergl/lasp/git/commits{/sha}","comments_url":"https://api.github.com/repos/ergl/lasp/comments{/number}","issue_comment_url":"https://api.github.com/repos/ergl/lasp/issues/comments{/number}","contents_url":"https://api.github.com/repos/ergl/lasp/contents/{+path}","compare_url":"https://api.github.com/repos/ergl/lasp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ergl/lasp/merges","archive_url":"https://api.github.com/repos/ergl/lasp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ergl/lasp/downloads","issues_url":"https://api.github.com/repos/ergl/lasp/issues{/number}","pulls_url":"https://api.github.com/repos/ergl/lasp/pulls{/number}","milestones_url":"https://api.github.com/repos/ergl/lasp/milestones{/number}","notifications_url":"https://api.github.com/repos/ergl/lasp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ergl/lasp/labels{/name}","releases_url":"https://api.github.com/repos/ergl/lasp/releases{/id}","deployments_url":"https://api.github.com/repos/ergl/lasp/deployments","created_at":"2016-05-04T09:34:24Z","updated_at":"2016-05-04T09:34:25Z","pushed_at":"2016-07-28T10:21:37Z","git_url":"git://github.com/ergl/lasp.git","ssh_url":"git@github.com:ergl/lasp.git","clone_url":"https://github.com/ergl/lasp.git","svn_url":"https://github.com/ergl/lasp","homepage":"http://lasp-lang.org","size":31955,"stargazers_count":0,"watchers_count":0,"language":"Erlang","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":"lasp-lang:unstable","ref":"unstable","sha":"c4cf53bd2f286229c8f859cd7ba0ec28c7859174","user":{"login":"lasp-lang","id":12764735,"avatar_url":"https://avatars.githubusercontent.com/u/12764735?v=3","gravatar_id":"","url":"https://api.github.com/users/lasp-lang","html_url":"https://github.com/lasp-lang","followers_url":"https://api.github.com/users/lasp-lang/followers","following_url":"https://api.github.com/users/lasp-lang/following{/other_user}","gists_url":"https://api.github.com/users/lasp-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/lasp-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lasp-lang/subscriptions","organizations_url":"https://api.github.com/users/lasp-lang/orgs","repos_url":"https://api.github.com/users/lasp-lang/repos","events_url":"https://api.github.com/users/lasp-lang/events{/privacy}","received_events_url":"https://api.github.com/users/lasp-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":20682452,"name":"lasp","full_name":"lasp-lang/lasp","owner":{"login":"lasp-lang","id":12764735,"avatar_url":"https://avatars.githubusercontent.com/u/12764735?v=3","gravatar_id":"","url":"https://api.github.com/users/lasp-lang","html_url":"https://github.com/lasp-lang","followers_url":"https://api.github.com/users/lasp-lang/followers","following_url":"https://api.github.com/users/lasp-lang/following{/other_user}","gists_url":"https://api.github.com/users/lasp-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/lasp-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lasp-lang/subscriptions","organizations_url":"https://api.github.com/users/lasp-lang/orgs","repos_url":"https://api.github.com/users/lasp-lang/repos","events_url":"https://api.github.com/users/lasp-lang/events{/privacy}","received_events_url":"https://api.github.com/users/lasp-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lasp-lang/lasp","description":"Prototype implementation of Lasp in Erlang.","fork":false,"url":"https://api.github.com/repos/lasp-lang/lasp","forks_url":"https://api.github.com/repos/lasp-lang/lasp/forks","keys_url":"https://api.github.com/repos/lasp-lang/lasp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lasp-lang/lasp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lasp-lang/lasp/teams","hooks_url":"https://api.github.com/repos/lasp-lang/lasp/hooks","issue_events_url":"https://api.github.com/repos/lasp-lang/lasp/issues/events{/number}","events_url":"https://api.github.com/repos/lasp-lang/lasp/events","assignees_url":"https://api.github.com/repos/lasp-lang/lasp/assignees{/user}","branches_url":"https://api.github.com/repos/lasp-lang/lasp/branches{/branch}","tags_url":"https://api.github.com/repos/lasp-lang/lasp/tags","blobs_url":"https://api.github.com/repos/lasp-lang/lasp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lasp-lang/lasp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lasp-lang/lasp/git/refs{/sha}","trees_url":"https://api.github.com/repos/lasp-lang/lasp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lasp-lang/lasp/statuses/{sha}","languages_url":"https://api.github.com/repos/lasp-lang/lasp/languages","stargazers_url":"https://api.github.com/repos/lasp-lang/lasp/stargazers","contributors_url":"https://api.github.com/repos/lasp-lang/lasp/contributors","subscribers_url":"https://api.github.com/repos/lasp-lang/lasp/subscribers","subscription_url":"https://api.github.com/repos/lasp-lang/lasp/subscription","commits_url":"https://api.github.com/repos/lasp-lang/lasp/commits{/sha}","git_commits_url":"https://api.github.com/repos/lasp-lang/lasp/git/commits{/sha}","comments_url":"https://api.github.com/repos/lasp-lang/lasp/comments{/number}","issue_comment_url":"https://api.github.com/repos/lasp-lang/lasp/issues/comments{/number}","contents_url":"https://api.github.com/repos/lasp-lang/lasp/contents/{+path}","compare_url":"https://api.github.com/repos/lasp-lang/lasp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lasp-lang/lasp/merges","archive_url":"https://api.github.com/repos/lasp-lang/lasp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lasp-lang/lasp/downloads","issues_url":"https://api.github.com/repos/lasp-lang/lasp/issues{/number}","pulls_url":"https://api.github.com/repos/lasp-lang/lasp/pulls{/number}","milestones_url":"https://api.github.com/repos/lasp-lang/lasp/milestones{/number}","notifications_url":"https://api.github.com/repos/lasp-lang/lasp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lasp-lang/lasp/labels{/name}","releases_url":"https://api.github.com/repos/lasp-lang/lasp/releases{/id}","deployments_url":"https://api.github.com/repos/lasp-lang/lasp/deployments","created_at":"2014-06-10T11:12:41Z","updated_at":"2016-07-29T14:21:36Z","pushed_at":"2016-07-29T17:08:24Z","git_url":"git://github.com/lasp-lang/lasp.git","ssh_url":"git@github.com:lasp-lang/lasp.git","clone_url":"https://github.com/lasp-lang/lasp.git","svn_url":"https://github.com/lasp-lang/lasp","homepage":"http://lasp-lang.org","size":32037,"stargazers_count":364,"watchers_count":364,"language":"Erlang","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":29,"mirror_url":null,"open_issues_count":3,"forks":29,"open_issues":3,"watchers":364,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lasp-lang/lasp/pulls/138"},"html":{"href":"https://github.com/lasp-lang/lasp/pull/138"},"issue":{"href":"https://api.github.com/repos/lasp-lang/lasp/issues/138"},"comments":{"href":"https://api.github.com/repos/lasp-lang/lasp/issues/138/comments"},"review_comments":{"href":"https://api.github.com/repos/lasp-lang/lasp/pulls/138/comments"},"review_comment":{"href":"https://api.github.com/repos/lasp-lang/lasp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lasp-lang/lasp/pulls/138/commits"},"statuses":{"href":"https://api.github.com/repos/lasp-lang/lasp/statuses/448762a30406cc9279ee77562736b1ce5f279b34"}}}}
{"actor":{"display_login":"ergl"}}