{"action":"created","comment":{"url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/pulls/comments/191396505","pull_request_review_id":123955131,"id":191396505,"diff_hunk":"@@ -0,0 +1,189 @@\n+import sys\n+sys.path.append('pypage')\n+sys.path.append('..')\n+import config\n+import json\n+from db import MongoDB\n+from datetime import datetime, timedelta\n+from kpi import Kpi\n+\n+\n+db = MongoDB(config.db_name)\n+\n+#TUDO: use multi tables in case of the table grows too big\n+class KpiRecord:\n+    def __init__(self):\n+        self.table = \"kpi\"\n+        self.name = None\n+        self.values = None\n+        self.type = None\n+        self.desc = None\n+        self.unit = None\n+\n+        \n+#TUDO: use multi tables in case of the table grows too big\n+class TaskRecord:\n+    def __init__(self):\n+        self.table = \"task\"\n+        self.name = None\n+        self.kpis = []\n+        \n+\n+class DetailRecord:\n+    '''the table contails all of the records'''\n+    '''an example for a record'''\n+    '''\n+\t'kpis-keys': ['train_acc_top5_kpi', 'train_cost_kpi', 'train_acc_top1_kpi'],\n+\t'infos': ['[train_acc_top1_kpi] failed, diff ratio: 0.9903790649141825 larger than 0.2.', '[train_acc_top5_kpi] failed, diff ratio: 0.9519000944325955 larger than 0.2.', '[train_cost_kpi] failed, diff ratio: 1.3212285037874993 larger than 0.2.'],\n+\t'date': '1524828005',\n+\t'passed': False,\n+\t'kpi-activeds': [True, True, True],\n+\t'kpis-values': '[[[0.02606865204870701]], [[6.907755374908447]], [[0.0032383420038968325]]]',\n+\t'kpi-descs': [None, None, None],\n+\t'type': 'kpi',\n+\t'kpi-types': ['LessWorseKpi', 'GreaterWorseKpi', 'LessWorseKpi'],\n+\t'kpi-unit-reprs': [None, None, None],\n+\t'commitid': '6e0b47b38c653a383ac2e7d16453536205e15f2d',\n+\t'task': 'image_classification',\n+\t'_id': ObjectId('5ae92ad31bebb5a990cc53f0')\n+}\n+    '''\n+\n+    def __init__(self, task='', commitid=''):\n+        self.table = \"logs\"\n+        self.id = None\n+        self.task = task\n+        self.date = None\n+        self.commitid = commitid\n+        self.task = None\n+        self.kpi_types = []\n+        self.kpi_keys = []\n+        self.kpi_values = []\n+        self.kpi_infos = []\n+        self.kpi_unit_reprs = []\n+        self.kpi_desc = []\n+        self.kpi_activeds = []\n+        self.passed = False\n+        self.type = 'kpi'\n+\n+    def get_all_records(self):\n+        return  db.finds(self.table, {'type': 'kpi'})\n+\n+    def get_records_by_commit(self):\n+        return db.finds(self.table, {'type': 'kpi', 'commitid': self.commitid})    \n+\n+  \n+def query_commit_from_details(commit):","path":"web/api.py","position":76,"original_position":76,"commit_id":"24bab58d6e7b351a279afe48eaa604a1906cdcc6","original_commit_id":"24bab58d6e7b351a279afe48eaa604a1906cdcc6","user":{"login":"Superjomn","id":328693,"avatar_url":"https://avatars1.githubusercontent.com/u/328693?v=4","gravatar_id":"","url":"https://api.github.com/users/Superjomn","html_url":"https://github.com/Superjomn","followers_url":"https://api.github.com/users/Superjomn/followers","following_url":"https://api.github.com/users/Superjomn/following{/other_user}","gists_url":"https://api.github.com/users/Superjomn/gists{/gist_id}","starred_url":"https://api.github.com/users/Superjomn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Superjomn/subscriptions","organizations_url":"https://api.github.com/users/Superjomn/orgs","repos_url":"https://api.github.com/users/Superjomn/repos","events_url":"https://api.github.com/users/Superjomn/events{/privacy}","received_events_url":"https://api.github.com/users/Superjomn/received_events","type":"User","site_admin":false},"body":"下面的函数的返回值都应该是 `KpiRecord` 和 `TaskRecord` 这两种标准数据类型，而不是其他定制类型，否则无法起到简化和清晰化数据类型的目的","created_at":"2018-05-29T11:57:21Z","updated_at":"2018-05-29T11:59:42Z","html_url":"https://github.com/PaddlePaddle/continuous_evaluation/pull/57#discussion_r191396505","pull_request_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/pulls/57","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/pulls/comments/191396505"},"html":{"href":"https://github.com/PaddlePaddle/continuous_evaluation/pull/57#discussion_r191396505"},"pull_request":{"href":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/pulls/57"}}},"pull_request":{"url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/pulls/57","id":190866908,"html_url":"https://github.com/PaddlePaddle/continuous_evaluation/pull/57","diff_url":"https://github.com/PaddlePaddle/continuous_evaluation/pull/57.diff","patch_url":"https://github.com/PaddlePaddle/continuous_evaluation/pull/57.patch","issue_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/issues/57","number":57,"state":"open","locked":false,"title":"some optimization for ce db","user":{"login":"guochaorong","id":32069604,"avatar_url":"https://avatars2.githubusercontent.com/u/32069604?v=4","gravatar_id":"","url":"https://api.github.com/users/guochaorong","html_url":"https://github.com/guochaorong","followers_url":"https://api.github.com/users/guochaorong/followers","following_url":"https://api.github.com/users/guochaorong/following{/other_user}","gists_url":"https://api.github.com/users/guochaorong/gists{/gist_id}","starred_url":"https://api.github.com/users/guochaorong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guochaorong/subscriptions","organizations_url":"https://api.github.com/users/guochaorong/orgs","repos_url":"https://api.github.com/users/guochaorong/repos","events_url":"https://api.github.com/users/guochaorong/events{/privacy}","received_events_url":"https://api.github.com/users/guochaorong/received_events","type":"User","site_admin":false},"body":"1. 增加db相应的接口函数\r\n2. 目前db使用一张表， 对表的查询比较简单。 以后扩展性可能好一些，目前没有太多的效果，\r\n请春伟帮忙看看是不是你期望的？","created_at":"2018-05-28T08:25:45Z","updated_at":"2018-05-29T11:59:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"82f45712d153cf925cb26874a10d5df58a8e2735","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/pulls/57/commits","review_comments_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/pulls/57/comments","review_comment_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/issues/57/comments","statuses_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/statuses/24bab58d6e7b351a279afe48eaa604a1906cdcc6","head":{"label":"guochaorong:update_db","ref":"update_db","sha":"24bab58d6e7b351a279afe48eaa604a1906cdcc6","user":{"login":"guochaorong","id":32069604,"avatar_url":"https://avatars2.githubusercontent.com/u/32069604?v=4","gravatar_id":"","url":"https://api.github.com/users/guochaorong","html_url":"https://github.com/guochaorong","followers_url":"https://api.github.com/users/guochaorong/followers","following_url":"https://api.github.com/users/guochaorong/following{/other_user}","gists_url":"https://api.github.com/users/guochaorong/gists{/gist_id}","starred_url":"https://api.github.com/users/guochaorong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guochaorong/subscriptions","organizations_url":"https://api.github.com/users/guochaorong/orgs","repos_url":"https://api.github.com/users/guochaorong/repos","events_url":"https://api.github.com/users/guochaorong/events{/privacy}","received_events_url":"https://api.github.com/users/guochaorong/received_events","type":"User","site_admin":false},"repo":{"id":132102495,"name":"continuous_evaluation","full_name":"guochaorong/continuous_evaluation","owner":{"login":"guochaorong","id":32069604,"avatar_url":"https://avatars2.githubusercontent.com/u/32069604?v=4","gravatar_id":"","url":"https://api.github.com/users/guochaorong","html_url":"https://github.com/guochaorong","followers_url":"https://api.github.com/users/guochaorong/followers","following_url":"https://api.github.com/users/guochaorong/following{/other_user}","gists_url":"https://api.github.com/users/guochaorong/gists{/gist_id}","starred_url":"https://api.github.com/users/guochaorong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guochaorong/subscriptions","organizations_url":"https://api.github.com/users/guochaorong/orgs","repos_url":"https://api.github.com/users/guochaorong/repos","events_url":"https://api.github.com/users/guochaorong/events{/privacy}","received_events_url":"https://api.github.com/users/guochaorong/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/guochaorong/continuous_evaluation","description":"Macro Continuous Evaluation Platform for Paddle.","fork":true,"url":"https://api.github.com/repos/guochaorong/continuous_evaluation","forks_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/forks","keys_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/teams","hooks_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/hooks","issue_events_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/issues/events{/number}","events_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/events","assignees_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/assignees{/user}","branches_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/branches{/branch}","tags_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/tags","blobs_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/git/refs{/sha}","trees_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/statuses/{sha}","languages_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/languages","stargazers_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/stargazers","contributors_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/contributors","subscribers_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/subscribers","subscription_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/subscription","commits_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/commits{/sha}","git_commits_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/git/commits{/sha}","comments_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/comments{/number}","issue_comment_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/issues/comments{/number}","contents_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/contents/{+path}","compare_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/merges","archive_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/downloads","issues_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/issues{/number}","pulls_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/pulls{/number}","milestones_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/milestones{/number}","notifications_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/labels{/name}","releases_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/releases{/id}","deployments_url":"https://api.github.com/repos/guochaorong/continuous_evaluation/deployments","created_at":"2018-05-04T07:09:22Z","updated_at":"2018-05-04T07:09:24Z","pushed_at":"2018-05-28T08:58:35Z","git_url":"git://github.com/guochaorong/continuous_evaluation.git","ssh_url":"git@github.com:guochaorong/continuous_evaluation.git","clone_url":"https://github.com/guochaorong/continuous_evaluation.git","svn_url":"https://github.com/guochaorong/continuous_evaluation","homepage":"","size":105,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"PaddlePaddle:develop","ref":"develop","sha":"0124743a8411619b908412313f811ffe31c3df86","user":{"login":"PaddlePaddle","id":23534030,"avatar_url":"https://avatars3.githubusercontent.com/u/23534030?v=4","gravatar_id":"","url":"https://api.github.com/users/PaddlePaddle","html_url":"https://github.com/PaddlePaddle","followers_url":"https://api.github.com/users/PaddlePaddle/followers","following_url":"https://api.github.com/users/PaddlePaddle/following{/other_user}","gists_url":"https://api.github.com/users/PaddlePaddle/gists{/gist_id}","starred_url":"https://api.github.com/users/PaddlePaddle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PaddlePaddle/subscriptions","organizations_url":"https://api.github.com/users/PaddlePaddle/orgs","repos_url":"https://api.github.com/users/PaddlePaddle/repos","events_url":"https://api.github.com/users/PaddlePaddle/events{/privacy}","received_events_url":"https://api.github.com/users/PaddlePaddle/received_events","type":"Organization","site_admin":false},"repo":{"id":125206311,"name":"continuous_evaluation","full_name":"PaddlePaddle/continuous_evaluation","owner":{"login":"PaddlePaddle","id":23534030,"avatar_url":"https://avatars3.githubusercontent.com/u/23534030?v=4","gravatar_id":"","url":"https://api.github.com/users/PaddlePaddle","html_url":"https://github.com/PaddlePaddle","followers_url":"https://api.github.com/users/PaddlePaddle/followers","following_url":"https://api.github.com/users/PaddlePaddle/following{/other_user}","gists_url":"https://api.github.com/users/PaddlePaddle/gists{/gist_id}","starred_url":"https://api.github.com/users/PaddlePaddle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PaddlePaddle/subscriptions","organizations_url":"https://api.github.com/users/PaddlePaddle/orgs","repos_url":"https://api.github.com/users/PaddlePaddle/repos","events_url":"https://api.github.com/users/PaddlePaddle/events{/privacy}","received_events_url":"https://api.github.com/users/PaddlePaddle/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PaddlePaddle/continuous_evaluation","description":"Macro Continuous Evaluation Platform for Paddle.","fork":false,"url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation","forks_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/forks","keys_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/teams","hooks_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/hooks","issue_events_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/issues/events{/number}","events_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/events","assignees_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/assignees{/user}","branches_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/branches{/branch}","tags_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/tags","blobs_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/git/refs{/sha}","trees_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/statuses/{sha}","languages_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/languages","stargazers_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/stargazers","contributors_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/contributors","subscribers_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/subscribers","subscription_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/subscription","commits_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/commits{/sha}","git_commits_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/git/commits{/sha}","comments_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/comments{/number}","issue_comment_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/issues/comments{/number}","contents_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/contents/{+path}","compare_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/merges","archive_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/downloads","issues_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/issues{/number}","pulls_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/pulls{/number}","milestones_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/milestones{/number}","notifications_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/labels{/name}","releases_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/releases{/id}","deployments_url":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/deployments","created_at":"2018-03-14T12:04:51Z","updated_at":"2018-05-29T11:51:17Z","pushed_at":"2018-05-29T11:51:21Z","git_url":"git://github.com/PaddlePaddle/continuous_evaluation.git","ssh_url":"git@github.com:PaddlePaddle/continuous_evaluation.git","clone_url":"https://github.com/PaddlePaddle/continuous_evaluation.git","svn_url":"https://github.com/PaddlePaddle/continuous_evaluation","homepage":"","size":98,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":16,"license":null,"forks":5,"open_issues":16,"watchers":5,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/pulls/57"},"html":{"href":"https://github.com/PaddlePaddle/continuous_evaluation/pull/57"},"issue":{"href":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/issues/57"},"comments":{"href":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/issues/57/comments"},"review_comments":{"href":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/pulls/57/comments"},"review_comment":{"href":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/pulls/57/commits"},"statuses":{"href":"https://api.github.com/repos/PaddlePaddle/continuous_evaluation/statuses/24bab58d6e7b351a279afe48eaa604a1906cdcc6"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Superjomn"}}