{"action":"created","comment":{"url":"https://api.github.com/repos/mapsme/Alohalytics/pulls/comments/65856740","id":65856740,"diff_hunk":"@@ -0,0 +1,164 @@\n+from __future__ import print_function\n+\n+import multiprocessing\n+import os\n+import shutil\n+import sys\n+import traceback\n+\n+from pyaloha.event_factory import EventFactory\n+from pyaloha.protocol import WorkerResults, str2date\n+from pyaloha.worker import invoke_cmd_worker, load_plugin, setup_logs\n+\n+\n+class DataStreamWorker(object):\n+    __events__ = tuple()\n+\n+    def __init__(self, event_factory=None):\n+        self._event_factory = event_factory or EventFactory(custom_events=[])\n+\n+    def process_unspecified(self, event):\n+        pass\n+\n+    def process_event(self,\n+                      key, event_time_p, user_info_p,\n+                      str_data_p, str_data_len):\n+        try:\n+            ev = self._event_factory.make_event(\n+                key, event_time_p[0], user_info_p[0],\n+                str_data_p, str_data_len\n+            )\n+            ev.process_me(self)\n+        except Exception:\n+            logger = multiprocessing.get_logger()\n+            logger.error(traceback.format_exc())\n+\n+    def dumps_results(self):\n+        return WorkerResults.dumps_object(self, debug=False)\n+\n+    def pre_output(self):\n+        pass\n+\n+\n+class DataAggregator(object):\n+    def __init__(self, results_dir=None, post_aggregate_worker=lambda x: x):\n+        self.post_aggregate_worker = post_aggregate_worker\n+\n+        self.results_dir = results_dir\n+        if self.results_dir:\n+            self.created_dirs = set()\n+            shutil.rmtree(self.results_dir, ignore_errors=True)\n+\n+    def aggregate(self):\n+        raise NotImplementedError()\n+\n+    def post_aggregate(self, pool=None):\n+        pass\n+\n+\n+class StatsProcessor(object):","path":"snippets/pyaloha/base.py","position":59,"original_position":59,"commit_id":"3407ebeb51f77126adaefc903e42f74c7fd61f1a","original_commit_id":"3407ebeb51f77126adaefc903e42f74c7fd61f1a","user":{"login":"ygorshenin","id":454567,"avatar_url":"https://avatars.githubusercontent.com/u/454567?v=3","gravatar_id":"","url":"https://api.github.com/users/ygorshenin","html_url":"https://github.com/ygorshenin","followers_url":"https://api.github.com/users/ygorshenin/followers","following_url":"https://api.github.com/users/ygorshenin/following{/other_user}","gists_url":"https://api.github.com/users/ygorshenin/gists{/gist_id}","starred_url":"https://api.github.com/users/ygorshenin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ygorshenin/subscriptions","organizations_url":"https://api.github.com/users/ygorshenin/orgs","repos_url":"https://api.github.com/users/ygorshenin/repos","events_url":"https://api.github.com/users/ygorshenin/events{/privacy}","received_events_url":"https://api.github.com/users/ygorshenin/received_events","type":"User","site_admin":false},"body":"Please, add comment to the class.","created_at":"2016-06-06T09:00:03Z","updated_at":"2016-06-06T09:00:03Z","html_url":"https://github.com/mapsme/Alohalytics/pull/12#discussion_r65856740","pull_request_url":"https://api.github.com/repos/mapsme/Alohalytics/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/mapsme/Alohalytics/pulls/comments/65856740"},"html":{"href":"https://github.com/mapsme/Alohalytics/pull/12#discussion_r65856740"},"pull_request":{"href":"https://api.github.com/repos/mapsme/Alohalytics/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/mapsme/Alohalytics/pulls/12","id":72165895,"html_url":"https://github.com/mapsme/Alohalytics/pull/12","diff_url":"https://github.com/mapsme/Alohalytics/pull/12.diff","patch_url":"https://github.com/mapsme/Alohalytics/pull/12.patch","issue_url":"https://api.github.com/repos/mapsme/Alohalytics/issues/12","number":12,"state":"open","locked":false,"title":"Python-powered scripting system added","user":{"login":"burivuh","id":2204417,"avatar_url":"https://avatars.githubusercontent.com/u/2204417?v=3","gravatar_id":"","url":"https://api.github.com/users/burivuh","html_url":"https://github.com/burivuh","followers_url":"https://api.github.com/users/burivuh/followers","following_url":"https://api.github.com/users/burivuh/following{/other_user}","gists_url":"https://api.github.com/users/burivuh/gists{/gist_id}","starred_url":"https://api.github.com/users/burivuh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burivuh/subscriptions","organizations_url":"https://api.github.com/users/burivuh/orgs","repos_url":"https://api.github.com/users/burivuh/repos","events_url":"https://api.github.com/users/burivuh/events{/privacy}","received_events_url":"https://api.github.com/users/burivuh/received_events","type":"User","site_admin":false},"body":"There are three parts:\r\n1) C module with a loop function based on Processor class\r\n2) Python framework named pyaloha\r\n3) Example script in examples directory","created_at":"2016-06-01T11:41:34Z","updated_at":"2016-06-06T09:00:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b88cd7b4dc46edbfde737f10d2426eea72a15fb1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mapsme/Alohalytics/pulls/12/commits","review_comments_url":"https://api.github.com/repos/mapsme/Alohalytics/pulls/12/comments","review_comment_url":"https://api.github.com/repos/mapsme/Alohalytics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mapsme/Alohalytics/issues/12/comments","statuses_url":"https://api.github.com/repos/mapsme/Alohalytics/statuses/3407ebeb51f77126adaefc903e42f74c7fd61f1a","head":{"label":"mapsme:python-api","ref":"python-api","sha":"3407ebeb51f77126adaefc903e42f74c7fd61f1a","user":{"login":"mapsme","id":14185141,"avatar_url":"https://avatars.githubusercontent.com/u/14185141?v=3","gravatar_id":"","url":"https://api.github.com/users/mapsme","html_url":"https://github.com/mapsme","followers_url":"https://api.github.com/users/mapsme/followers","following_url":"https://api.github.com/users/mapsme/following{/other_user}","gists_url":"https://api.github.com/users/mapsme/gists{/gist_id}","starred_url":"https://api.github.com/users/mapsme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapsme/subscriptions","organizations_url":"https://api.github.com/users/mapsme/orgs","repos_url":"https://api.github.com/users/mapsme/repos","events_url":"https://api.github.com/users/mapsme/events{/privacy}","received_events_url":"https://api.github.com/users/mapsme/received_events","type":"Organization","site_admin":false},"repo":{"id":44220892,"name":"Alohalytics","full_name":"mapsme/Alohalytics","owner":{"login":"mapsme","id":14185141,"avatar_url":"https://avatars.githubusercontent.com/u/14185141?v=3","gravatar_id":"","url":"https://api.github.com/users/mapsme","html_url":"https://github.com/mapsme","followers_url":"https://api.github.com/users/mapsme/followers","following_url":"https://api.github.com/users/mapsme/following{/other_user}","gists_url":"https://api.github.com/users/mapsme/gists{/gist_id}","starred_url":"https://api.github.com/users/mapsme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapsme/subscriptions","organizations_url":"https://api.github.com/users/mapsme/orgs","repos_url":"https://api.github.com/users/mapsme/repos","events_url":"https://api.github.com/users/mapsme/events{/privacy}","received_events_url":"https://api.github.com/users/mapsme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mapsme/Alohalytics","description":"","fork":true,"url":"https://api.github.com/repos/mapsme/Alohalytics","forks_url":"https://api.github.com/repos/mapsme/Alohalytics/forks","keys_url":"https://api.github.com/repos/mapsme/Alohalytics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapsme/Alohalytics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapsme/Alohalytics/teams","hooks_url":"https://api.github.com/repos/mapsme/Alohalytics/hooks","issue_events_url":"https://api.github.com/repos/mapsme/Alohalytics/issues/events{/number}","events_url":"https://api.github.com/repos/mapsme/Alohalytics/events","assignees_url":"https://api.github.com/repos/mapsme/Alohalytics/assignees{/user}","branches_url":"https://api.github.com/repos/mapsme/Alohalytics/branches{/branch}","tags_url":"https://api.github.com/repos/mapsme/Alohalytics/tags","blobs_url":"https://api.github.com/repos/mapsme/Alohalytics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapsme/Alohalytics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapsme/Alohalytics/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapsme/Alohalytics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapsme/Alohalytics/statuses/{sha}","languages_url":"https://api.github.com/repos/mapsme/Alohalytics/languages","stargazers_url":"https://api.github.com/repos/mapsme/Alohalytics/stargazers","contributors_url":"https://api.github.com/repos/mapsme/Alohalytics/contributors","subscribers_url":"https://api.github.com/repos/mapsme/Alohalytics/subscribers","subscription_url":"https://api.github.com/repos/mapsme/Alohalytics/subscription","commits_url":"https://api.github.com/repos/mapsme/Alohalytics/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapsme/Alohalytics/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapsme/Alohalytics/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapsme/Alohalytics/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapsme/Alohalytics/contents/{+path}","compare_url":"https://api.github.com/repos/mapsme/Alohalytics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapsme/Alohalytics/merges","archive_url":"https://api.github.com/repos/mapsme/Alohalytics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapsme/Alohalytics/downloads","issues_url":"https://api.github.com/repos/mapsme/Alohalytics/issues{/number}","pulls_url":"https://api.github.com/repos/mapsme/Alohalytics/pulls{/number}","milestones_url":"https://api.github.com/repos/mapsme/Alohalytics/milestones{/number}","notifications_url":"https://api.github.com/repos/mapsme/Alohalytics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapsme/Alohalytics/labels{/name}","releases_url":"https://api.github.com/repos/mapsme/Alohalytics/releases{/id}","deployments_url":"https://api.github.com/repos/mapsme/Alohalytics/deployments","created_at":"2015-10-14T03:11:06Z","updated_at":"2016-01-22T12:36:52Z","pushed_at":"2016-06-03T08:46:33Z","git_url":"git://github.com/mapsme/Alohalytics.git","ssh_url":"git@github.com:mapsme/Alohalytics.git","clone_url":"https://github.com/mapsme/Alohalytics.git","svn_url":"https://github.com/mapsme/Alohalytics","homepage":null,"size":1595,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"mapsme:master","ref":"master","sha":"5c46d5b4c7fc6f24fa01076be1ce55a824a2b5e8","user":{"login":"mapsme","id":14185141,"avatar_url":"https://avatars.githubusercontent.com/u/14185141?v=3","gravatar_id":"","url":"https://api.github.com/users/mapsme","html_url":"https://github.com/mapsme","followers_url":"https://api.github.com/users/mapsme/followers","following_url":"https://api.github.com/users/mapsme/following{/other_user}","gists_url":"https://api.github.com/users/mapsme/gists{/gist_id}","starred_url":"https://api.github.com/users/mapsme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapsme/subscriptions","organizations_url":"https://api.github.com/users/mapsme/orgs","repos_url":"https://api.github.com/users/mapsme/repos","events_url":"https://api.github.com/users/mapsme/events{/privacy}","received_events_url":"https://api.github.com/users/mapsme/received_events","type":"Organization","site_admin":false},"repo":{"id":44220892,"name":"Alohalytics","full_name":"mapsme/Alohalytics","owner":{"login":"mapsme","id":14185141,"avatar_url":"https://avatars.githubusercontent.com/u/14185141?v=3","gravatar_id":"","url":"https://api.github.com/users/mapsme","html_url":"https://github.com/mapsme","followers_url":"https://api.github.com/users/mapsme/followers","following_url":"https://api.github.com/users/mapsme/following{/other_user}","gists_url":"https://api.github.com/users/mapsme/gists{/gist_id}","starred_url":"https://api.github.com/users/mapsme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapsme/subscriptions","organizations_url":"https://api.github.com/users/mapsme/orgs","repos_url":"https://api.github.com/users/mapsme/repos","events_url":"https://api.github.com/users/mapsme/events{/privacy}","received_events_url":"https://api.github.com/users/mapsme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mapsme/Alohalytics","description":"","fork":true,"url":"https://api.github.com/repos/mapsme/Alohalytics","forks_url":"https://api.github.com/repos/mapsme/Alohalytics/forks","keys_url":"https://api.github.com/repos/mapsme/Alohalytics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapsme/Alohalytics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapsme/Alohalytics/teams","hooks_url":"https://api.github.com/repos/mapsme/Alohalytics/hooks","issue_events_url":"https://api.github.com/repos/mapsme/Alohalytics/issues/events{/number}","events_url":"https://api.github.com/repos/mapsme/Alohalytics/events","assignees_url":"https://api.github.com/repos/mapsme/Alohalytics/assignees{/user}","branches_url":"https://api.github.com/repos/mapsme/Alohalytics/branches{/branch}","tags_url":"https://api.github.com/repos/mapsme/Alohalytics/tags","blobs_url":"https://api.github.com/repos/mapsme/Alohalytics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapsme/Alohalytics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapsme/Alohalytics/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapsme/Alohalytics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapsme/Alohalytics/statuses/{sha}","languages_url":"https://api.github.com/repos/mapsme/Alohalytics/languages","stargazers_url":"https://api.github.com/repos/mapsme/Alohalytics/stargazers","contributors_url":"https://api.github.com/repos/mapsme/Alohalytics/contributors","subscribers_url":"https://api.github.com/repos/mapsme/Alohalytics/subscribers","subscription_url":"https://api.github.com/repos/mapsme/Alohalytics/subscription","commits_url":"https://api.github.com/repos/mapsme/Alohalytics/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapsme/Alohalytics/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapsme/Alohalytics/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapsme/Alohalytics/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapsme/Alohalytics/contents/{+path}","compare_url":"https://api.github.com/repos/mapsme/Alohalytics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapsme/Alohalytics/merges","archive_url":"https://api.github.com/repos/mapsme/Alohalytics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapsme/Alohalytics/downloads","issues_url":"https://api.github.com/repos/mapsme/Alohalytics/issues{/number}","pulls_url":"https://api.github.com/repos/mapsme/Alohalytics/pulls{/number}","milestones_url":"https://api.github.com/repos/mapsme/Alohalytics/milestones{/number}","notifications_url":"https://api.github.com/repos/mapsme/Alohalytics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapsme/Alohalytics/labels{/name}","releases_url":"https://api.github.com/repos/mapsme/Alohalytics/releases{/id}","deployments_url":"https://api.github.com/repos/mapsme/Alohalytics/deployments","created_at":"2015-10-14T03:11:06Z","updated_at":"2016-01-22T12:36:52Z","pushed_at":"2016-06-03T08:46:33Z","git_url":"git://github.com/mapsme/Alohalytics.git","ssh_url":"git@github.com:mapsme/Alohalytics.git","clone_url":"https://github.com/mapsme/Alohalytics.git","svn_url":"https://github.com/mapsme/Alohalytics","homepage":null,"size":1595,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mapsme/Alohalytics/pulls/12"},"html":{"href":"https://github.com/mapsme/Alohalytics/pull/12"},"issue":{"href":"https://api.github.com/repos/mapsme/Alohalytics/issues/12"},"comments":{"href":"https://api.github.com/repos/mapsme/Alohalytics/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/mapsme/Alohalytics/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/mapsme/Alohalytics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mapsme/Alohalytics/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/mapsme/Alohalytics/statuses/3407ebeb51f77126adaefc903e42f74c7fd61f1a"}}}}
{"actor":{"display_login":"ygorshenin"}}