GitHub PullRequestReviewCommentEvent at 2014-07-17 16:03:30
Repository: kronos
Actor: marcua
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/Locu/kronos/pulls/comments/15066493","id":15066493,"diff_hunk":"@@ -108,25 +168,20 @@ def delete_board(id=None):\n def callsource(id=None):\n   request_body = request.get_json()\n   code = request_body.get('code')\n-\n-  locals_dict = {\n-    'kronos_client': KronosClient(app.config['KRONOS_URL'],\n-                                  namespace=app.config['KRONOS_NAMESPACE']),\n-    'events': []\n-    }\n-\n-  # TODO(marcua): We'll evenutally get rid of this security issue\n-  # (i.e., `exec` is bad!) once we build a query building interface.\n-  # In the meanwhile, we trust in user authentication.\n-  if code:\n-    try:\n-      exec code in {}, locals_dict # No globals.\n-    except:\n-      _, exception, tb = sys.exc_info()\n-      raise PyCodeError(exception, tb)\n-\n-  events = sorted(locals_dict.get('events', []),\n-                  key=lambda event: event['@time'])\n+  precompute = request_body.get('precompute')\n+  timeframe = request_body.get('timeframe')\n+  bucket_width = get_seconds(precompute['bucket_width']['value'],\n+                             precompute['bucket_width']['scale'])\n+  bucket_width = epoch_time_to_kronos_time(bucket_width)\n+  untrusted_time = get_seconds(precompute['untrusted_time']['value'],\n+                               precompute['untrusted_time']['scale'])\n+  now = datetime.datetime.now()\n+  untrusted_datetime = now - datetime.timedelta(seconds=untrusted_time)\n+\n+  events = precompute_cache(code, timeframe, bucket_width,","path":"jia/jia/views.py","position":116,"original_position":116,"commit_id":"94e59e8b84f3eb1a72637105adb2549e13238895","original_commit_id":"94e59e8b84f3eb1a72637105adb2549e13238895","user":{"login":"marcua","id":57725,"avatar_url":"https://avatars.githubusercontent.com/u/57725?","gravatar_id":"5c893ce0a9e1ccda8ea8b3de6ba8abb5","url":"https://api.github.com/users/marcua","html_url":"https://github.com/marcua","followers_url":"https://api.github.com/users/marcua/followers","following_url":"https://api.github.com/users/marcua/following{/other_user}","gists_url":"https://api.github.com/users/marcua/gists{/gist_id}","starred_url":"https://api.github.com/users/marcua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcua/subscriptions","organizations_url":"https://api.github.com/users/marcua/orgs","repos_url":"https://api.github.com/users/marcua/repos","events_url":"https://api.github.com/users/marcua/events{/privacy}","received_events_url":"https://api.github.com/users/marcua/received_events","type":"User","site_admin":false},"body":"What if you're not precomputing?  Won't bucket_width and untrusted time be irrelevant/cause incorrect results?","created_at":"2014-07-17T16:03:30Z","updated_at":"2014-07-17T16:03:30Z","html_url":"https://github.com/Locu/kronos/pull/91#discussion_r15066493","pull_request_url":"https://api.github.com/repos/Locu/kronos/pulls/91","_links":{"self":{"href":"https://api.github.com/repos/Locu/kronos/pulls/comments/15066493"},"html":{"href":"https://github.com/Locu/kronos/pull/91#discussion_r15066493"},"pull_request":{"href":"https://api.github.com/repos/Locu/kronos/pulls/91"}}},"pull_request":{"url":"https://api.github.com/repos/Locu/kronos/pulls/91","id":18413904,"html_url":"https://github.com/Locu/kronos/pull/91","diff_url":"https://github.com/Locu/kronos/pull/91.diff","patch_url":"https://github.com/Locu/kronos/pull/91.patch","issue_url":"https://api.github.com/repos/Locu/kronos/issues/91","number":91,"state":"open","title":"Add scheduled query precompute functionality","user":{"login":"derek-schultz","id":1996521,"avatar_url":"https://avatars.githubusercontent.com/u/1996521?","gravatar_id":"f92423eff04ef98ccc03098b95bacbd8","url":"https://api.github.com/users/derek-schultz","html_url":"https://github.com/derek-schultz","followers_url":"https://api.github.com/users/derek-schultz/followers","following_url":"https://api.github.com/users/derek-schultz/following{/other_user}","gists_url":"https://api.github.com/users/derek-schultz/gists{/gist_id}","starred_url":"https://api.github.com/users/derek-schultz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derek-schultz/subscriptions","organizations_url":"https://api.github.com/users/derek-schultz/orgs","repos_url":"https://api.github.com/users/derek-schultz/repos","events_url":"https://api.github.com/users/derek-schultz/events{/privacy}","received_events_url":"https://api.github.com/users/derek-schultz/received_events","type":"User","site_admin":false},"body":"The Jia UI now provides a timeframe interface, where the user specifies either a recent timeframe:\r\n![screen shot 2014-07-15 at 11 06 58 am](https://cloud.githubusercontent.com/assets/1996521/3586576/ba488dce-0c31-11e4-9967-b29e3dad75f6.png)\r\n\r\nor a specific date range:\r\n![screen shot 2014-07-15 at 11 07 16 am](https://cloud.githubusercontent.com/assets/1996521/3586577/ba48ca1e-0c31-11e4-9c6f-909f742ace17.png)\r\n\r\nThe `start_time` and `end_time` variables are automatically injected into the scope of the query code blob (along with `events` and `kronos_client`).\r\n\r\nWhen the precompute switch is activated, the results of the query code blob will be cached. When the query is over a recent timeframe, additional options are provided to the user so that the precomputation will happen on a schedule. This ensures the cache is always fresh when a user runs the query. When the query is over a specific date range, the precomputation is done only once.","created_at":"2014-07-15T15:12:14Z","updated_at":"2014-07-17T16:03:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"30bec9fbffe2f665c73dfe06790bb56f74215439","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Locu/kronos/pulls/91/commits","review_comments_url":"https://api.github.com/repos/Locu/kronos/pulls/91/comments","review_comment_url":"https://api.github.com/repos/Locu/kronos/pulls/comments/{number}","comments_url":"https://api.github.com/repos/Locu/kronos/issues/91/comments","statuses_url":"https://api.github.com/repos/Locu/kronos/statuses/94e59e8b84f3eb1a72637105adb2549e13238895","head":{"label":"Locu:precompute","ref":"precompute","sha":"94e59e8b84f3eb1a72637105adb2549e13238895","user":{"login":"Locu","id":999587,"avatar_url":"https://avatars.githubusercontent.com/u/999587?","gravatar_id":"888cb04a7a4152b54793fbd66a62bf1e","url":"https://api.github.com/users/Locu","html_url":"https://github.com/Locu","followers_url":"https://api.github.com/users/Locu/followers","following_url":"https://api.github.com/users/Locu/following{/other_user}","gists_url":"https://api.github.com/users/Locu/gists{/gist_id}","starred_url":"https://api.github.com/users/Locu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Locu/subscriptions","organizations_url":"https://api.github.com/users/Locu/orgs","repos_url":"https://api.github.com/users/Locu/repos","events_url":"https://api.github.com/users/Locu/events{/privacy}","received_events_url":"https://api.github.com/users/Locu/received_events","type":"Organization","site_admin":false},"repo":{"id":9482565,"name":"kronos","full_name":"Locu/kronos","owner":{"login":"Locu","id":999587,"avatar_url":"https://avatars.githubusercontent.com/u/999587?","gravatar_id":"888cb04a7a4152b54793fbd66a62bf1e","url":"https://api.github.com/users/Locu","html_url":"https://github.com/Locu","followers_url":"https://api.github.com/users/Locu/followers","following_url":"https://api.github.com/users/Locu/following{/other_user}","gists_url":"https://api.github.com/users/Locu/gists{/gist_id}","starred_url":"https://api.github.com/users/Locu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Locu/subscriptions","organizations_url":"https://api.github.com/users/Locu/orgs","repos_url":"https://api.github.com/users/Locu/repos","events_url":"https://api.github.com/users/Locu/events{/privacy}","received_events_url":"https://api.github.com/users/Locu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Locu/kronos","description":"","fork":false,"url":"https://api.github.com/repos/Locu/kronos","forks_url":"https://api.github.com/repos/Locu/kronos/forks","keys_url":"https://api.github.com/repos/Locu/kronos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Locu/kronos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Locu/kronos/teams","hooks_url":"https://api.github.com/repos/Locu/kronos/hooks","issue_events_url":"https://api.github.com/repos/Locu/kronos/issues/events{/number}","events_url":"https://api.github.com/repos/Locu/kronos/events","assignees_url":"https://api.github.com/repos/Locu/kronos/assignees{/user}","branches_url":"https://api.github.com/repos/Locu/kronos/branches{/branch}","tags_url":"https://api.github.com/repos/Locu/kronos/tags","blobs_url":"https://api.github.com/repos/Locu/kronos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Locu/kronos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Locu/kronos/git/refs{/sha}","trees_url":"https://api.github.com/repos/Locu/kronos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Locu/kronos/statuses/{sha}","languages_url":"https://api.github.com/repos/Locu/kronos/languages","stargazers_url":"https://api.github.com/repos/Locu/kronos/stargazers","contributors_url":"https://api.github.com/repos/Locu/kronos/contributors","subscribers_url":"https://api.github.com/repos/Locu/kronos/subscribers","subscription_url":"https://api.github.com/repos/Locu/kronos/subscription","commits_url":"https://api.github.com/repos/Locu/kronos/commits{/sha}","git_commits_url":"https://api.github.com/repos/Locu/kronos/git/commits{/sha}","comments_url":"https://api.github.com/repos/Locu/kronos/comments{/number}","issue_comment_url":"https://api.github.com/repos/Locu/kronos/issues/comments/{number}","contents_url":"https://api.github.com/repos/Locu/kronos/contents/{+path}","compare_url":"https://api.github.com/repos/Locu/kronos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Locu/kronos/merges","archive_url":"https://api.github.com/repos/Locu/kronos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Locu/kronos/downloads","issues_url":"https://api.github.com/repos/Locu/kronos/issues{/number}","pulls_url":"https://api.github.com/repos/Locu/kronos/pulls{/number}","milestones_url":"https://api.github.com/repos/Locu/kronos/milestones{/number}","notifications_url":"https://api.github.com/repos/Locu/kronos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Locu/kronos/labels{/name}","releases_url":"https://api.github.com/repos/Locu/kronos/releases{/id}","created_at":"2013-04-16T21:03:21Z","updated_at":"2014-06-25T14:04:44Z","pushed_at":"2014-07-17T15:14:33Z","git_url":"git://github.com/Locu/kronos.git","ssh_url":"git@github.com:Locu/kronos.git","clone_url":"https://github.com/Locu/kronos.git","svn_url":"https://github.com/Locu/kronos","homepage":null,"size":4854,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":1,"mirror_url":null,"open_issues_count":30,"forks":1,"open_issues":30,"watchers":4,"default_branch":"master"}},"base":{"label":"Locu:master","ref":"master","sha":"dee20f547a0ee8ccfb1907430353a881260eb658","user":{"login":"Locu","id":999587,"avatar_url":"https://avatars.githubusercontent.com/u/999587?","gravatar_id":"888cb04a7a4152b54793fbd66a62bf1e","url":"https://api.github.com/users/Locu","html_url":"https://github.com/Locu","followers_url":"https://api.github.com/users/Locu/followers","following_url":"https://api.github.com/users/Locu/following{/other_user}","gists_url":"https://api.github.com/users/Locu/gists{/gist_id}","starred_url":"https://api.github.com/users/Locu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Locu/subscriptions","organizations_url":"https://api.github.com/users/Locu/orgs","repos_url":"https://api.github.com/users/Locu/repos","events_url":"https://api.github.com/users/Locu/events{/privacy}","received_events_url":"https://api.github.com/users/Locu/received_events","type":"Organization","site_admin":false},"repo":{"id":9482565,"name":"kronos","full_name":"Locu/kronos","owner":{"login":"Locu","id":999587,"avatar_url":"https://avatars.githubusercontent.com/u/999587?","gravatar_id":"888cb04a7a4152b54793fbd66a62bf1e","url":"https://api.github.com/users/Locu","html_url":"https://github.com/Locu","followers_url":"https://api.github.com/users/Locu/followers","following_url":"https://api.github.com/users/Locu/following{/other_user}","gists_url":"https://api.github.com/users/Locu/gists{/gist_id}","starred_url":"https://api.github.com/users/Locu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Locu/subscriptions","organizations_url":"https://api.github.com/users/Locu/orgs","repos_url":"https://api.github.com/users/Locu/repos","events_url":"https://api.github.com/users/Locu/events{/privacy}","received_events_url":"https://api.github.com/users/Locu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Locu/kronos","description":"","fork":false,"url":"https://api.github.com/repos/Locu/kronos","forks_url":"https://api.github.com/repos/Locu/kronos/forks","keys_url":"https://api.github.com/repos/Locu/kronos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Locu/kronos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Locu/kronos/teams","hooks_url":"https://api.github.com/repos/Locu/kronos/hooks","issue_events_url":"https://api.github.com/repos/Locu/kronos/issues/events{/number}","events_url":"https://api.github.com/repos/Locu/kronos/events","assignees_url":"https://api.github.com/repos/Locu/kronos/assignees{/user}","branches_url":"https://api.github.com/repos/Locu/kronos/branches{/branch}","tags_url":"https://api.github.com/repos/Locu/kronos/tags","blobs_url":"https://api.github.com/repos/Locu/kronos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Locu/kronos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Locu/kronos/git/refs{/sha}","trees_url":"https://api.github.com/repos/Locu/kronos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Locu/kronos/statuses/{sha}","languages_url":"https://api.github.com/repos/Locu/kronos/languages","stargazers_url":"https://api.github.com/repos/Locu/kronos/stargazers","contributors_url":"https://api.github.com/repos/Locu/kronos/contributors","subscribers_url":"https://api.github.com/repos/Locu/kronos/subscribers","subscription_url":"https://api.github.com/repos/Locu/kronos/subscription","commits_url":"https://api.github.com/repos/Locu/kronos/commits{/sha}","git_commits_url":"https://api.github.com/repos/Locu/kronos/git/commits{/sha}","comments_url":"https://api.github.com/repos/Locu/kronos/comments{/number}","issue_comment_url":"https://api.github.com/repos/Locu/kronos/issues/comments/{number}","contents_url":"https://api.github.com/repos/Locu/kronos/contents/{+path}","compare_url":"https://api.github.com/repos/Locu/kronos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Locu/kronos/merges","archive_url":"https://api.github.com/repos/Locu/kronos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Locu/kronos/downloads","issues_url":"https://api.github.com/repos/Locu/kronos/issues{/number}","pulls_url":"https://api.github.com/repos/Locu/kronos/pulls{/number}","milestones_url":"https://api.github.com/repos/Locu/kronos/milestones{/number}","notifications_url":"https://api.github.com/repos/Locu/kronos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Locu/kronos/labels{/name}","releases_url":"https://api.github.com/repos/Locu/kronos/releases{/id}","created_at":"2013-04-16T21:03:21Z","updated_at":"2014-06-25T14:04:44Z","pushed_at":"2014-07-17T15:14:33Z","git_url":"git://github.com/Locu/kronos.git","ssh_url":"git@github.com:Locu/kronos.git","clone_url":"https://github.com/Locu/kronos.git","svn_url":"https://github.com/Locu/kronos","homepage":null,"size":4854,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":1,"mirror_url":null,"open_issues_count":30,"forks":1,"open_issues":30,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Locu/kronos/pulls/91"},"html":{"href":"https://github.com/Locu/kronos/pull/91"},"issue":{"href":"https://api.github.com/repos/Locu/kronos/issues/91"},"comments":{"href":"https://api.github.com/repos/Locu/kronos/issues/91/comments"},"review_comments":{"href":"https://api.github.com/repos/Locu/kronos/pulls/91/comments"},"review_comment":{"href":"https://api.github.com/repos/Locu/kronos/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/Locu/kronos/pulls/91/commits"},"statuses":{"href":"https://api.github.com/repos/Locu/kronos/statuses/94e59e8b84f3eb1a72637105adb2549e13238895"}}}}