{"action":"created","comment":{"url":"https://api.github.com/repos/elParcero/data-monitoring/pulls/comments/200696968","pull_request_review_id":135068476,"id":200696968,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDY5Njk2OA==","diff_hunk":"@@ -0,0 +1,102 @@\n+#0002\n+from databroker import Broker\n+import pandas as pd\n+import os\n+\n+import datetime\n+import time\n+from time import mktime\n+\n+from eiger_io.fs_handler import EigerHandler\n+from databroker.assets.handlers import AreaDetectorTiffHandler\n+\n+def file_sizes(hdrs, db):\n+\n+    unique_resources = set()\n+    time_size = dict()\n+    file_sizes = list()\n+    FILESTORE_KEY = \"FILESTORE:\"\n+    start_time = time.time()\n+    timestamp = 0.0\n+    for hdr in hdrs:\n+        for stream_name in hdr.stream_names:\n+            events = hdr.events(stream_name=stream_name)\n+            events = iter(events)\n+            while True:\n+                try:\n+                    event = next(events)\n+                    if \"filled\" in event:\n+                        # there are keys that may not be filled\n+                        for key, val in event['filled'].items():\n+                            # if this is true, then we have a datum\n+                            if not val:\n+                                # get the datum\n+                                if key in event['data']:\n+                                    datum_id = event['data'][key]\n+                                    resource = (db.reg.resource_given_datum_id(datum_id))\n+                                    resource_id = resource['uid']\n+                                    if resource_id in unique_resources:\n+                                        continue\n+                                    else:\n+                                        unique_resources.add(resource_id)\n+                                    datum_gen = db.reg.datum_gen_given_resource(resource_id)\n+                                    datum_kwargs = [datum['datum_kwargs'] for datum in datum_gen]\n+                                    timestamp = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(event['time'])))\n+                                    timestamp = time.strptime(timestamp, '%Y-%m-%d %H:%M:%S')\n+                                    timestamp = datetime.datetime.fromtimestamp(mktime(timestamp))\n+                                    # get the file handler using this\n+                                    fh = db.reg.get_spec_handler(resource_id)\n+                                    print(fh)\n+                                    file_sizes = sum(fh.get_file_sizes(datum_kwargs))","path":"exercises/0002_eiger_handler.py","position":50,"original_position":50,"commit_id":"f433b55d04c310327fa40900b5f2c26281e27bd7","original_commit_id":"f433b55d04c310327fa40900b5f2c26281e27bd7","user":{"login":"elParcero","id":32808705,"node_id":"MDQ6VXNlcjMyODA4NzA1","avatar_url":"https://avatars2.githubusercontent.com/u/32808705?v=4","gravatar_id":"","url":"https://api.github.com/users/elParcero","html_url":"https://github.com/elParcero","followers_url":"https://api.github.com/users/elParcero/followers","following_url":"https://api.github.com/users/elParcero/following{/other_user}","gists_url":"https://api.github.com/users/elParcero/gists{/gist_id}","starred_url":"https://api.github.com/users/elParcero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elParcero/subscriptions","organizations_url":"https://api.github.com/users/elParcero/orgs","repos_url":"https://api.github.com/users/elParcero/repos","events_url":"https://api.github.com/users/elParcero/events{/privacy}","received_events_url":"https://api.github.com/users/elParcero/received_events","type":"User","site_admin":false},"body":"The file list that is returned includes more than one file, which means I would have to get the size for both files, sum them up, and then assign the sum of the file usage to the file size correct? So I'd need a loop in there?","created_at":"2018-07-06T15:57:23Z","updated_at":"2018-07-06T15:57:23Z","html_url":"https://github.com/elParcero/data-monitoring/pull/25#discussion_r200696968","pull_request_url":"https://api.github.com/repos/elParcero/data-monitoring/pulls/25","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/elParcero/data-monitoring/pulls/comments/200696968"},"html":{"href":"https://github.com/elParcero/data-monitoring/pull/25#discussion_r200696968"},"pull_request":{"href":"https://api.github.com/repos/elParcero/data-monitoring/pulls/25"}},"in_reply_to_id":200690200},"pull_request":{"url":"https://api.github.com/repos/elParcero/data-monitoring/pulls/25","id":199778476,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5Nzc4NDc2","html_url":"https://github.com/elParcero/data-monitoring/pull/25","diff_url":"https://github.com/elParcero/data-monitoring/pull/25.diff","patch_url":"https://github.com/elParcero/data-monitoring/pull/25.patch","issue_url":"https://api.github.com/repos/elParcero/data-monitoring/issues/25","number":25,"state":"open","locked":false,"title":"Area Detector","user":{"login":"elParcero","id":32808705,"node_id":"MDQ6VXNlcjMyODA4NzA1","avatar_url":"https://avatars2.githubusercontent.com/u/32808705?v=4","gravatar_id":"","url":"https://api.github.com/users/elParcero","html_url":"https://github.com/elParcero","followers_url":"https://api.github.com/users/elParcero/followers","following_url":"https://api.github.com/users/elParcero/following{/other_user}","gists_url":"https://api.github.com/users/elParcero/gists{/gist_id}","starred_url":"https://api.github.com/users/elParcero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elParcero/subscriptions","organizations_url":"https://api.github.com/users/elParcero/orgs","repos_url":"https://api.github.com/users/elParcero/repos","events_url":"https://api.github.com/users/elParcero/events{/privacy}","received_events_url":"https://api.github.com/users/elParcero/received_events","type":"User","site_admin":false},"body":"Using file handler to get file size and list (EigerHandler and AreaDetectorTiffHandler).","created_at":"2018-07-06T15:24:31Z","updated_at":"2018-07-06T15:57:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6965921e29117cf0c80e5281a6217d0dcb6ebffa","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/elParcero/data-monitoring/pulls/25/commits","review_comments_url":"https://api.github.com/repos/elParcero/data-monitoring/pulls/25/comments","review_comment_url":"https://api.github.com/repos/elParcero/data-monitoring/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elParcero/data-monitoring/issues/25/comments","statuses_url":"https://api.github.com/repos/elParcero/data-monitoring/statuses/f433b55d04c310327fa40900b5f2c26281e27bd7","head":{"label":"elParcero:area_detector","ref":"area_detector","sha":"f433b55d04c310327fa40900b5f2c26281e27bd7","user":{"login":"elParcero","id":32808705,"node_id":"MDQ6VXNlcjMyODA4NzA1","avatar_url":"https://avatars2.githubusercontent.com/u/32808705?v=4","gravatar_id":"","url":"https://api.github.com/users/elParcero","html_url":"https://github.com/elParcero","followers_url":"https://api.github.com/users/elParcero/followers","following_url":"https://api.github.com/users/elParcero/following{/other_user}","gists_url":"https://api.github.com/users/elParcero/gists{/gist_id}","starred_url":"https://api.github.com/users/elParcero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elParcero/subscriptions","organizations_url":"https://api.github.com/users/elParcero/orgs","repos_url":"https://api.github.com/users/elParcero/repos","events_url":"https://api.github.com/users/elParcero/events{/privacy}","received_events_url":"https://api.github.com/users/elParcero/received_events","type":"User","site_admin":false},"repo":{"id":136512291,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY1MTIyOTE=","name":"data-monitoring","full_name":"elParcero/data-monitoring","owner":{"login":"elParcero","id":32808705,"node_id":"MDQ6VXNlcjMyODA4NzA1","avatar_url":"https://avatars2.githubusercontent.com/u/32808705?v=4","gravatar_id":"","url":"https://api.github.com/users/elParcero","html_url":"https://github.com/elParcero","followers_url":"https://api.github.com/users/elParcero/followers","following_url":"https://api.github.com/users/elParcero/following{/other_user}","gists_url":"https://api.github.com/users/elParcero/gists{/gist_id}","starred_url":"https://api.github.com/users/elParcero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elParcero/subscriptions","organizations_url":"https://api.github.com/users/elParcero/orgs","repos_url":"https://api.github.com/users/elParcero/repos","events_url":"https://api.github.com/users/elParcero/events{/privacy}","received_events_url":"https://api.github.com/users/elParcero/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/elParcero/data-monitoring","description":"Exercises done at BNL ","fork":false,"url":"https://api.github.com/repos/elParcero/data-monitoring","forks_url":"https://api.github.com/repos/elParcero/data-monitoring/forks","keys_url":"https://api.github.com/repos/elParcero/data-monitoring/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elParcero/data-monitoring/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elParcero/data-monitoring/teams","hooks_url":"https://api.github.com/repos/elParcero/data-monitoring/hooks","issue_events_url":"https://api.github.com/repos/elParcero/data-monitoring/issues/events{/number}","events_url":"https://api.github.com/repos/elParcero/data-monitoring/events","assignees_url":"https://api.github.com/repos/elParcero/data-monitoring/assignees{/user}","branches_url":"https://api.github.com/repos/elParcero/data-monitoring/branches{/branch}","tags_url":"https://api.github.com/repos/elParcero/data-monitoring/tags","blobs_url":"https://api.github.com/repos/elParcero/data-monitoring/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elParcero/data-monitoring/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elParcero/data-monitoring/git/refs{/sha}","trees_url":"https://api.github.com/repos/elParcero/data-monitoring/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elParcero/data-monitoring/statuses/{sha}","languages_url":"https://api.github.com/repos/elParcero/data-monitoring/languages","stargazers_url":"https://api.github.com/repos/elParcero/data-monitoring/stargazers","contributors_url":"https://api.github.com/repos/elParcero/data-monitoring/contributors","subscribers_url":"https://api.github.com/repos/elParcero/data-monitoring/subscribers","subscription_url":"https://api.github.com/repos/elParcero/data-monitoring/subscription","commits_url":"https://api.github.com/repos/elParcero/data-monitoring/commits{/sha}","git_commits_url":"https://api.github.com/repos/elParcero/data-monitoring/git/commits{/sha}","comments_url":"https://api.github.com/repos/elParcero/data-monitoring/comments{/number}","issue_comment_url":"https://api.github.com/repos/elParcero/data-monitoring/issues/comments{/number}","contents_url":"https://api.github.com/repos/elParcero/data-monitoring/contents/{+path}","compare_url":"https://api.github.com/repos/elParcero/data-monitoring/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elParcero/data-monitoring/merges","archive_url":"https://api.github.com/repos/elParcero/data-monitoring/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elParcero/data-monitoring/downloads","issues_url":"https://api.github.com/repos/elParcero/data-monitoring/issues{/number}","pulls_url":"https://api.github.com/repos/elParcero/data-monitoring/pulls{/number}","milestones_url":"https://api.github.com/repos/elParcero/data-monitoring/milestones{/number}","notifications_url":"https://api.github.com/repos/elParcero/data-monitoring/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elParcero/data-monitoring/labels{/name}","releases_url":"https://api.github.com/repos/elParcero/data-monitoring/releases{/id}","deployments_url":"https://api.github.com/repos/elParcero/data-monitoring/deployments","created_at":"2018-06-07T17:49:44Z","updated_at":"2018-06-28T16:23:49Z","pushed_at":"2018-07-06T15:42:00Z","git_url":"git://github.com/elParcero/data-monitoring.git","ssh_url":"git@github.com:elParcero/data-monitoring.git","clone_url":"https://github.com/elParcero/data-monitoring.git","svn_url":"https://github.com/elParcero/data-monitoring","homepage":"","size":10637,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":8,"license":null,"forks":1,"open_issues":8,"watchers":0,"default_branch":"master"}},"base":{"label":"elParcero:master","ref":"master","sha":"b19865d7ba0d26008c266199a5f9c740e1eaa096","user":{"login":"elParcero","id":32808705,"node_id":"MDQ6VXNlcjMyODA4NzA1","avatar_url":"https://avatars2.githubusercontent.com/u/32808705?v=4","gravatar_id":"","url":"https://api.github.com/users/elParcero","html_url":"https://github.com/elParcero","followers_url":"https://api.github.com/users/elParcero/followers","following_url":"https://api.github.com/users/elParcero/following{/other_user}","gists_url":"https://api.github.com/users/elParcero/gists{/gist_id}","starred_url":"https://api.github.com/users/elParcero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elParcero/subscriptions","organizations_url":"https://api.github.com/users/elParcero/orgs","repos_url":"https://api.github.com/users/elParcero/repos","events_url":"https://api.github.com/users/elParcero/events{/privacy}","received_events_url":"https://api.github.com/users/elParcero/received_events","type":"User","site_admin":false},"repo":{"id":136512291,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY1MTIyOTE=","name":"data-monitoring","full_name":"elParcero/data-monitoring","owner":{"login":"elParcero","id":32808705,"node_id":"MDQ6VXNlcjMyODA4NzA1","avatar_url":"https://avatars2.githubusercontent.com/u/32808705?v=4","gravatar_id":"","url":"https://api.github.com/users/elParcero","html_url":"https://github.com/elParcero","followers_url":"https://api.github.com/users/elParcero/followers","following_url":"https://api.github.com/users/elParcero/following{/other_user}","gists_url":"https://api.github.com/users/elParcero/gists{/gist_id}","starred_url":"https://api.github.com/users/elParcero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elParcero/subscriptions","organizations_url":"https://api.github.com/users/elParcero/orgs","repos_url":"https://api.github.com/users/elParcero/repos","events_url":"https://api.github.com/users/elParcero/events{/privacy}","received_events_url":"https://api.github.com/users/elParcero/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/elParcero/data-monitoring","description":"Exercises done at BNL ","fork":false,"url":"https://api.github.com/repos/elParcero/data-monitoring","forks_url":"https://api.github.com/repos/elParcero/data-monitoring/forks","keys_url":"https://api.github.com/repos/elParcero/data-monitoring/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elParcero/data-monitoring/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elParcero/data-monitoring/teams","hooks_url":"https://api.github.com/repos/elParcero/data-monitoring/hooks","issue_events_url":"https://api.github.com/repos/elParcero/data-monitoring/issues/events{/number}","events_url":"https://api.github.com/repos/elParcero/data-monitoring/events","assignees_url":"https://api.github.com/repos/elParcero/data-monitoring/assignees{/user}","branches_url":"https://api.github.com/repos/elParcero/data-monitoring/branches{/branch}","tags_url":"https://api.github.com/repos/elParcero/data-monitoring/tags","blobs_url":"https://api.github.com/repos/elParcero/data-monitoring/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elParcero/data-monitoring/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elParcero/data-monitoring/git/refs{/sha}","trees_url":"https://api.github.com/repos/elParcero/data-monitoring/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elParcero/data-monitoring/statuses/{sha}","languages_url":"https://api.github.com/repos/elParcero/data-monitoring/languages","stargazers_url":"https://api.github.com/repos/elParcero/data-monitoring/stargazers","contributors_url":"https://api.github.com/repos/elParcero/data-monitoring/contributors","subscribers_url":"https://api.github.com/repos/elParcero/data-monitoring/subscribers","subscription_url":"https://api.github.com/repos/elParcero/data-monitoring/subscription","commits_url":"https://api.github.com/repos/elParcero/data-monitoring/commits{/sha}","git_commits_url":"https://api.github.com/repos/elParcero/data-monitoring/git/commits{/sha}","comments_url":"https://api.github.com/repos/elParcero/data-monitoring/comments{/number}","issue_comment_url":"https://api.github.com/repos/elParcero/data-monitoring/issues/comments{/number}","contents_url":"https://api.github.com/repos/elParcero/data-monitoring/contents/{+path}","compare_url":"https://api.github.com/repos/elParcero/data-monitoring/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elParcero/data-monitoring/merges","archive_url":"https://api.github.com/repos/elParcero/data-monitoring/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elParcero/data-monitoring/downloads","issues_url":"https://api.github.com/repos/elParcero/data-monitoring/issues{/number}","pulls_url":"https://api.github.com/repos/elParcero/data-monitoring/pulls{/number}","milestones_url":"https://api.github.com/repos/elParcero/data-monitoring/milestones{/number}","notifications_url":"https://api.github.com/repos/elParcero/data-monitoring/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elParcero/data-monitoring/labels{/name}","releases_url":"https://api.github.com/repos/elParcero/data-monitoring/releases{/id}","deployments_url":"https://api.github.com/repos/elParcero/data-monitoring/deployments","created_at":"2018-06-07T17:49:44Z","updated_at":"2018-06-28T16:23:49Z","pushed_at":"2018-07-06T15:42:00Z","git_url":"git://github.com/elParcero/data-monitoring.git","ssh_url":"git@github.com:elParcero/data-monitoring.git","clone_url":"https://github.com/elParcero/data-monitoring.git","svn_url":"https://github.com/elParcero/data-monitoring","homepage":"","size":10637,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":8,"license":null,"forks":1,"open_issues":8,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elParcero/data-monitoring/pulls/25"},"html":{"href":"https://github.com/elParcero/data-monitoring/pull/25"},"issue":{"href":"https://api.github.com/repos/elParcero/data-monitoring/issues/25"},"comments":{"href":"https://api.github.com/repos/elParcero/data-monitoring/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/elParcero/data-monitoring/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/elParcero/data-monitoring/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elParcero/data-monitoring/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/elParcero/data-monitoring/statuses/f433b55d04c310327fa40900b5f2c26281e27bd7"}},"author_association":"OWNER"}}
{"actor":{"display_login":"elParcero"}}