{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-airflow/pulls/comments/74873512","id":74873512,"diff_hunk":"@@ -3626,6 +3629,52 @@ def delete(cls, xcoms, session=None):\n         session.commit()\n \n \n+class DagStat(Base):\n+    __tablename__ = \"dag_stats\"\n+\n+    dag_id = Column(String(ID_LEN), primary_key=True)\n+    state = Column(String(50), primary_key=True)\n+    count = Column(Integer, default=0)\n+    dirty = Column(Boolean, default=False)\n+\n+    def __init__(self, dag_id, state, count, dirty=False):\n+        self.dag_id = dag_id\n+        self.state = state\n+        self.count = count\n+        self.dirty = dirty\n+\n+    @staticmethod\n+    @provide_session\n+    def set_dirty(dag_id, session=None):\n+        for dag in session.query(DagStat).filter(DagStat.dag_id == dag_id):\n+            dag.dirty = True\n+        session.commit()\n+\n+    @staticmethod\n+    @provide_session\n+    def clean_dirty(session=None):\n+        dirty_dags = {dag.dag_id for dag in session.query(DagStat).filter_by(dirty=True)}\n+        session.query(DagStat).filter_by(dirty=True).delete()","path":"airflow/models.py","position":69,"original_position":69,"commit_id":"2c916db7c46790e6e581a731b90e1151ada421b4","original_commit_id":"2c916db7c46790e6e581a731b90e1151ada421b4","user":{"login":"r39132","id":581734,"avatar_url":"https://avatars.githubusercontent.com/u/581734?v=3","gravatar_id":"","url":"https://api.github.com/users/r39132","html_url":"https://github.com/r39132","followers_url":"https://api.github.com/users/r39132/followers","following_url":"https://api.github.com/users/r39132/following{/other_user}","gists_url":"https://api.github.com/users/r39132/gists{/gist_id}","starred_url":"https://api.github.com/users/r39132/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/r39132/subscriptions","organizations_url":"https://api.github.com/users/r39132/orgs","repos_url":"https://api.github.com/users/r39132/repos","events_url":"https://api.github.com/users/r39132/events{/privacy}","received_events_url":"https://api.github.com/users/r39132/received_events","type":"User","site_admin":false},"body":"Combine these 2 queries into 1","created_at":"2016-08-16T04:06:25Z","updated_at":"2016-08-16T04:06:25Z","html_url":"https://github.com/apache/incubator-airflow/pull/1730#discussion_r74873512","pull_request_url":"https://api.github.com/repos/apache/incubator-airflow/pulls/1730","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-airflow/pulls/comments/74873512"},"html":{"href":"https://github.com/apache/incubator-airflow/pull/1730#discussion_r74873512"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-airflow/pulls/1730"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-airflow/pulls/1730","id":81199169,"html_url":"https://github.com/apache/incubator-airflow/pull/1730","diff_url":"https://github.com/apache/incubator-airflow/pull/1730.diff","patch_url":"https://github.com/apache/incubator-airflow/pull/1730.patch","issue_url":"https://api.github.com/repos/apache/incubator-airflow/issues/1730","number":1730,"state":"open","locked":false,"title":"[AIRFLOW-329] Update Dag Overview Page with Better Status Columns","user":{"login":"normster","id":6687910,"avatar_url":"https://avatars.githubusercontent.com/u/6687910?v=3","gravatar_id":"","url":"https://api.github.com/users/normster","html_url":"https://github.com/normster","followers_url":"https://api.github.com/users/normster/followers","following_url":"https://api.github.com/users/normster/following{/other_user}","gists_url":"https://api.github.com/users/normster/gists{/gist_id}","starred_url":"https://api.github.com/users/normster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normster/subscriptions","organizations_url":"https://api.github.com/users/normster/orgs","repos_url":"https://api.github.com/users/normster/repos","events_url":"https://api.github.com/users/normster/events{/privacy}","received_events_url":"https://api.github.com/users/normster/received_events","type":"User","site_admin":false},"body":"Dear Airflow Maintainers,\r\n\r\nPlease accept this PR that addresses the following issues:\r\n- https://issues.apache.org/jira/browse/AIRFLOW-329\r\n\r\nTesting Done:\r\n- Added a unit test to core tests, tests that dag_stats table is appropriately updated after dagrun creation and state change\r\n-Added sanity check for '/dag_stats' and '/task_stats' API endpoints\r\n\r\nRenamed 'Recent Statuses' to 'Recent Tasks'. Created 'DAG Stats' column. Created a cache table dag_stats to hold data for 'DAG Stats' column with dirty bit for each row. Upon dagrun creation, state change, or deletion via web UI, appropriate rows will have dirty set to true and then dirty rows will be refreshed with up to date data. Upon execution of `airflow webserver` command, all rows in dag_stat will be dirtied and cleaned.\r\n\r\nAPI endpoints in views.py have also been changed. '/dag_stats' has been renamed to '/task_stats', and endpoint reused for the 'DAG Stats' column.","created_at":"2016-08-13T00:02:51Z","updated_at":"2016-08-16T04:06:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e0b6f44c3469e45305d9f91fa452564a094c6d5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-airflow/pulls/1730/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-airflow/pulls/1730/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-airflow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-airflow/issues/1730/comments","statuses_url":"https://api.github.com/repos/apache/incubator-airflow/statuses/2c916db7c46790e6e581a731b90e1151ada421b4","head":{"label":"normster:dagstat","ref":"dagstat","sha":"2c916db7c46790e6e581a731b90e1151ada421b4","user":{"login":"normster","id":6687910,"avatar_url":"https://avatars.githubusercontent.com/u/6687910?v=3","gravatar_id":"","url":"https://api.github.com/users/normster","html_url":"https://github.com/normster","followers_url":"https://api.github.com/users/normster/followers","following_url":"https://api.github.com/users/normster/following{/other_user}","gists_url":"https://api.github.com/users/normster/gists{/gist_id}","starred_url":"https://api.github.com/users/normster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normster/subscriptions","organizations_url":"https://api.github.com/users/normster/orgs","repos_url":"https://api.github.com/users/normster/repos","events_url":"https://api.github.com/users/normster/events{/privacy}","received_events_url":"https://api.github.com/users/normster/received_events","type":"User","site_admin":false},"repo":{"id":62837998,"name":"incubator-airflow","full_name":"normster/incubator-airflow","owner":{"login":"normster","id":6687910,"avatar_url":"https://avatars.githubusercontent.com/u/6687910?v=3","gravatar_id":"","url":"https://api.github.com/users/normster","html_url":"https://github.com/normster","followers_url":"https://api.github.com/users/normster/followers","following_url":"https://api.github.com/users/normster/following{/other_user}","gists_url":"https://api.github.com/users/normster/gists{/gist_id}","starred_url":"https://api.github.com/users/normster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normster/subscriptions","organizations_url":"https://api.github.com/users/normster/orgs","repos_url":"https://api.github.com/users/normster/repos","events_url":"https://api.github.com/users/normster/events{/privacy}","received_events_url":"https://api.github.com/users/normster/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/normster/incubator-airflow","description":"Apache Airflow (Incubating)","fork":true,"url":"https://api.github.com/repos/normster/incubator-airflow","forks_url":"https://api.github.com/repos/normster/incubator-airflow/forks","keys_url":"https://api.github.com/repos/normster/incubator-airflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/normster/incubator-airflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/normster/incubator-airflow/teams","hooks_url":"https://api.github.com/repos/normster/incubator-airflow/hooks","issue_events_url":"https://api.github.com/repos/normster/incubator-airflow/issues/events{/number}","events_url":"https://api.github.com/repos/normster/incubator-airflow/events","assignees_url":"https://api.github.com/repos/normster/incubator-airflow/assignees{/user}","branches_url":"https://api.github.com/repos/normster/incubator-airflow/branches{/branch}","tags_url":"https://api.github.com/repos/normster/incubator-airflow/tags","blobs_url":"https://api.github.com/repos/normster/incubator-airflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/normster/incubator-airflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/normster/incubator-airflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/normster/incubator-airflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/normster/incubator-airflow/statuses/{sha}","languages_url":"https://api.github.com/repos/normster/incubator-airflow/languages","stargazers_url":"https://api.github.com/repos/normster/incubator-airflow/stargazers","contributors_url":"https://api.github.com/repos/normster/incubator-airflow/contributors","subscribers_url":"https://api.github.com/repos/normster/incubator-airflow/subscribers","subscription_url":"https://api.github.com/repos/normster/incubator-airflow/subscription","commits_url":"https://api.github.com/repos/normster/incubator-airflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/normster/incubator-airflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/normster/incubator-airflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/normster/incubator-airflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/normster/incubator-airflow/contents/{+path}","compare_url":"https://api.github.com/repos/normster/incubator-airflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/normster/incubator-airflow/merges","archive_url":"https://api.github.com/repos/normster/incubator-airflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/normster/incubator-airflow/downloads","issues_url":"https://api.github.com/repos/normster/incubator-airflow/issues{/number}","pulls_url":"https://api.github.com/repos/normster/incubator-airflow/pulls{/number}","milestones_url":"https://api.github.com/repos/normster/incubator-airflow/milestones{/number}","notifications_url":"https://api.github.com/repos/normster/incubator-airflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/normster/incubator-airflow/labels{/name}","releases_url":"https://api.github.com/repos/normster/incubator-airflow/releases{/id}","deployments_url":"https://api.github.com/repos/normster/incubator-airflow/deployments","created_at":"2016-07-07T21:03:15Z","updated_at":"2016-07-27T22:40:59Z","pushed_at":"2016-08-16T03:37:53Z","git_url":"git://github.com/normster/incubator-airflow.git","ssh_url":"git@github.com:normster/incubator-airflow.git","clone_url":"https://github.com/normster/incubator-airflow.git","svn_url":"https://github.com/normster/incubator-airflow","homepage":"","size":10633,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"apache:master","ref":"master","sha":"821bdb5310c6c21cd9c0b9d0797873ff6114179d","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":33884891,"name":"incubator-airflow","full_name":"apache/incubator-airflow","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/incubator-airflow","description":"Apache Airflow (Incubating)","fork":false,"url":"https://api.github.com/repos/apache/incubator-airflow","forks_url":"https://api.github.com/repos/apache/incubator-airflow/forks","keys_url":"https://api.github.com/repos/apache/incubator-airflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-airflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-airflow/teams","hooks_url":"https://api.github.com/repos/apache/incubator-airflow/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-airflow/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-airflow/events","assignees_url":"https://api.github.com/repos/apache/incubator-airflow/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-airflow/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-airflow/tags","blobs_url":"https://api.github.com/repos/apache/incubator-airflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-airflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-airflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-airflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-airflow/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-airflow/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-airflow/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-airflow/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-airflow/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-airflow/subscription","commits_url":"https://api.github.com/repos/apache/incubator-airflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-airflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-airflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-airflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-airflow/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-airflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-airflow/merges","archive_url":"https://api.github.com/repos/apache/incubator-airflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-airflow/downloads","issues_url":"https://api.github.com/repos/apache/incubator-airflow/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-airflow/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-airflow/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-airflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-airflow/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-airflow/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-airflow/deployments","created_at":"2015-04-13T18:04:58Z","updated_at":"2016-08-16T02:00:52Z","pushed_at":"2016-08-16T03:59:38Z","git_url":"git://github.com/apache/incubator-airflow.git","ssh_url":"git@github.com:apache/incubator-airflow.git","clone_url":"https://github.com/apache/incubator-airflow.git","svn_url":"https://github.com/apache/incubator-airflow","homepage":"","size":14160,"stargazers_count":3288,"watchers_count":3288,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":768,"mirror_url":null,"open_issues_count":199,"forks":768,"open_issues":199,"watchers":3288,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-airflow/pulls/1730"},"html":{"href":"https://github.com/apache/incubator-airflow/pull/1730"},"issue":{"href":"https://api.github.com/repos/apache/incubator-airflow/issues/1730"},"comments":{"href":"https://api.github.com/repos/apache/incubator-airflow/issues/1730/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-airflow/pulls/1730/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-airflow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-airflow/pulls/1730/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-airflow/statuses/2c916db7c46790e6e581a731b90e1151ada421b4"}}}}
{"actor":{"display_login":"r39132"}}