{"action":"created","comment":{"url":"https://api.github.com/repos/iDPLcn/idpl_parser/pulls/comments/31389482","id":31389482,"diff_hunk":"@@ -0,0 +1,343 @@\n+#!/usr/bin/env python\n+# encoding: UTF-8\n+\n+import socket,ssl\n+import sys,os\n+import time\n+from thread import *\n+import re, getopt\n+import CondorTools\n+from xml.etree import ElementTree as ET\n+\n+chirp = CondorTools.CondorChirp()\n+\n+class FileReader:\n+\t\n+\tdef __init__(self):\n+\t\t\n+\t\tself.fileUri = \"\"\n+\t\tself.offsetLast = 0\n+\t\tself.offsetNew = 0\n+\t\tself.offsetNow = 0\n+\t\tself.timestampNew = \"\"\n+\t\tself.isHasChanged = False\n+\t\n+\tdef read(self, fileUriNow):\n+\t\twith open(fileUriNow) as text:\n+\t\t\treturn text.readlines()\n+\t\n+\tdef getALine(self, fileLines):\n+\t\t return fileLines.pop()\n+\n+\tdef match(self, reg, strToMatch, timestamp):\n+\t\tmatch = re.compile(reg).search(strToMatch)\n+\t\t\n+\t\tif match:\n+\t\t\ttimestampNow = match.group()[1:(len(match.group()) - 1)].split(',')[3]\n+\t\t\tif not self.isHasChanged:\n+\t\t\t\tself.timestampNew = timestampNow\n+\t\t\t\tself.offsetNew = self.offsetNow\n+\t\t\t\tself.isHasChanged = True\n+\t\t\treturn float(timestampNow) > timestamp\t\t\t\t\n+\t\telse:\n+\t\t\tif not self.isHasChanged:\n+\t\t\t\tself.offsetNow += 1\n+\t\t\treturn True\n+\n+\tdef getNewFilePath(self, suffix):\n+\t\treturn \"%s.%d\" % (self.fileUri, suffix), suffix + 1\n+\t\n+\n+\tdef chooseLinesInAFile(self, fileLines, reg, timestamp, strAdded, isTimeReached):\n+\t\twhile len(fileLines):\n+\t\t\tline = self.getALine(fileLines)\n+\t\t\tif self.match(reg, line, timestamp):\n+\t\t\t\tstrAdded.insert(0, line)\n+\t\t\telse:\n+\t\t\t\tisTimeReached = True\n+\t\t\t\tbreak\n+\t\treturn strAdded, isTimeReached\n+\t\t\n+\n+\tdef chooseLines(self, timestamp, offsetL, path):\n+\t\tself.fileUri = path\n+\t\tself.offsetLast = offsetL\n+\t\treg = \"'iperf.*'\"\n+\t\tisTimeReached = False\n+\t\tstrAdded = []\n+\t\tfileUriNow = self.fileUri\n+\t\tsuffix = 0\n+\t\tif not os.path.exists(fileUriNow):\n+\t\t\tprint(\"file not exist!\")\n+\t\t\tsys.exit(0)\n+\t\twhile (not isTimeReached and os.path.exists(fileUriNow)):\n+\t\t\tfileLines = self.read(fileUriNow)\n+\t\t\tstrAdded, isTimeReached = self.chooseLinesInAFile(fileLines, reg, timestamp, strAdded, isTimeReached)\n+\t\t\tfileUriNow, suffix = self.getNewFilePath(suffix)\n+\t\treturn ''.join(strAdded[self.offsetLast:]), self.timestampNew, str(self.offsetNew)\n+\n+class Server:\n+\tdef __init__(self, path, port):\n+\t\tself.path = path\n+\t\tself.host = socket.getfqdn()\n+\t\tself.port = port\n+\t\n+\tdef commuWithClient(self, conn):\n+\t\ttimestamp = \"\"\n+\t\ttimestampNew = \"\"\n+\t\toffset = \"\"\n+\t\toffsetNew = \"\"\n+\t\twhile True:\n+\t\t\tdata = conn.recv(64)\n+\t\t\t\n+\t\t\tif self.match(r\"\\d+(\\.\\d+)?,\\d+\", data):\n+\t\t\t\ttimestamp, offset = data.split(',')\n+\t\t\t\tstrAdded, timestampNew, offsetNew = FileReader().chooseLines(float(timestamp), int(offset), self.path)\n+\t\t\t\tdataToSend = \"%sKUNSIGN%sKUNSIGN%s\" % (strAdded, timestampNew, offsetNew)","path":"synchronizer/sslMover.py","position":96,"original_position":96,"commit_id":"671b0d2251e21ac274d3a7c643c71776912c1bb0","original_commit_id":"671b0d2251e21ac274d3a7c643c71776912c1bb0","user":{"login":"JarvisZhang","id":6338665,"avatar_url":"https://avatars.githubusercontent.com/u/6338665?v=3","gravatar_id":"","url":"https://api.github.com/users/JarvisZhang","html_url":"https://github.com/JarvisZhang","followers_url":"https://api.github.com/users/JarvisZhang/followers","following_url":"https://api.github.com/users/JarvisZhang/following{/other_user}","gists_url":"https://api.github.com/users/JarvisZhang/gists{/gist_id}","starred_url":"https://api.github.com/users/JarvisZhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JarvisZhang/subscriptions","organizations_url":"https://api.github.com/users/JarvisZhang/orgs","repos_url":"https://api.github.com/users/JarvisZhang/repos","events_url":"https://api.github.com/users/JarvisZhang/events{/privacy}","received_events_url":"https://api.github.com/users/JarvisZhang/received_events","type":"User","site_admin":false},"body":"KUNSIGN?","created_at":"2015-05-31T11:55:50Z","updated_at":"2015-05-31T11:55:50Z","html_url":"https://github.com/iDPLcn/idpl_parser/pull/2#discussion_r31389482","pull_request_url":"https://api.github.com/repos/iDPLcn/idpl_parser/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/iDPLcn/idpl_parser/pulls/comments/31389482"},"html":{"href":"https://github.com/iDPLcn/idpl_parser/pull/2#discussion_r31389482"},"pull_request":{"href":"https://api.github.com/repos/iDPLcn/idpl_parser/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/iDPLcn/idpl_parser/pulls/2","id":36580672,"html_url":"https://github.com/iDPLcn/idpl_parser/pull/2","diff_url":"https://github.com/iDPLcn/idpl_parser/pull/2.diff","patch_url":"https://github.com/iDPLcn/idpl_parser/pull/2.patch","issue_url":"https://api.github.com/repos/iDPLcn/idpl_parser/issues/2","number":2,"state":"open","locked":false,"title":"merge to sslMover and sslMain","user":{"login":"JarvisZhang","id":6338665,"avatar_url":"https://avatars.githubusercontent.com/u/6338665?v=3","gravatar_id":"","url":"https://api.github.com/users/JarvisZhang","html_url":"https://github.com/JarvisZhang","followers_url":"https://api.github.com/users/JarvisZhang/followers","following_url":"https://api.github.com/users/JarvisZhang/following{/other_user}","gists_url":"https://api.github.com/users/JarvisZhang/gists{/gist_id}","starred_url":"https://api.github.com/users/JarvisZhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JarvisZhang/subscriptions","organizations_url":"https://api.github.com/users/JarvisZhang/orgs","repos_url":"https://api.github.com/users/JarvisZhang/repos","events_url":"https://api.github.com/users/JarvisZhang/events{/privacy}","received_events_url":"https://api.github.com/users/JarvisZhang/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-31T11:19:19Z","updated_at":"2015-05-31T11:55:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"584153a3f25221eb978d046d1e7cfe05bb00b8c0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/iDPLcn/idpl_parser/pulls/2/commits","review_comments_url":"https://api.github.com/repos/iDPLcn/idpl_parser/pulls/2/comments","review_comment_url":"https://api.github.com/repos/iDPLcn/idpl_parser/pulls/comments{/number}","comments_url":"https://api.github.com/repos/iDPLcn/idpl_parser/issues/2/comments","statuses_url":"https://api.github.com/repos/iDPLcn/idpl_parser/statuses/671b0d2251e21ac274d3a7c643c71776912c1bb0","head":{"label":"iDPLcn:develop","ref":"develop","sha":"671b0d2251e21ac274d3a7c643c71776912c1bb0","user":{"login":"iDPLcn","id":9314613,"avatar_url":"https://avatars.githubusercontent.com/u/9314613?v=3","gravatar_id":"","url":"https://api.github.com/users/iDPLcn","html_url":"https://github.com/iDPLcn","followers_url":"https://api.github.com/users/iDPLcn/followers","following_url":"https://api.github.com/users/iDPLcn/following{/other_user}","gists_url":"https://api.github.com/users/iDPLcn/gists{/gist_id}","starred_url":"https://api.github.com/users/iDPLcn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iDPLcn/subscriptions","organizations_url":"https://api.github.com/users/iDPLcn/orgs","repos_url":"https://api.github.com/users/iDPLcn/repos","events_url":"https://api.github.com/users/iDPLcn/events{/privacy}","received_events_url":"https://api.github.com/users/iDPLcn/received_events","type":"Organization","site_admin":false},"repo":{"id":35491507,"name":"idpl_parser","full_name":"iDPLcn/idpl_parser","owner":{"login":"iDPLcn","id":9314613,"avatar_url":"https://avatars.githubusercontent.com/u/9314613?v=3","gravatar_id":"","url":"https://api.github.com/users/iDPLcn","html_url":"https://github.com/iDPLcn","followers_url":"https://api.github.com/users/iDPLcn/followers","following_url":"https://api.github.com/users/iDPLcn/following{/other_user}","gists_url":"https://api.github.com/users/iDPLcn/gists{/gist_id}","starred_url":"https://api.github.com/users/iDPLcn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iDPLcn/subscriptions","organizations_url":"https://api.github.com/users/iDPLcn/orgs","repos_url":"https://api.github.com/users/iDPLcn/repos","events_url":"https://api.github.com/users/iDPLcn/events{/privacy}","received_events_url":"https://api.github.com/users/iDPLcn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/iDPLcn/idpl_parser","description":"Scripts for log sync and parse. ","fork":false,"url":"https://api.github.com/repos/iDPLcn/idpl_parser","forks_url":"https://api.github.com/repos/iDPLcn/idpl_parser/forks","keys_url":"https://api.github.com/repos/iDPLcn/idpl_parser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iDPLcn/idpl_parser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iDPLcn/idpl_parser/teams","hooks_url":"https://api.github.com/repos/iDPLcn/idpl_parser/hooks","issue_events_url":"https://api.github.com/repos/iDPLcn/idpl_parser/issues/events{/number}","events_url":"https://api.github.com/repos/iDPLcn/idpl_parser/events","assignees_url":"https://api.github.com/repos/iDPLcn/idpl_parser/assignees{/user}","branches_url":"https://api.github.com/repos/iDPLcn/idpl_parser/branches{/branch}","tags_url":"https://api.github.com/repos/iDPLcn/idpl_parser/tags","blobs_url":"https://api.github.com/repos/iDPLcn/idpl_parser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iDPLcn/idpl_parser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iDPLcn/idpl_parser/git/refs{/sha}","trees_url":"https://api.github.com/repos/iDPLcn/idpl_parser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iDPLcn/idpl_parser/statuses/{sha}","languages_url":"https://api.github.com/repos/iDPLcn/idpl_parser/languages","stargazers_url":"https://api.github.com/repos/iDPLcn/idpl_parser/stargazers","contributors_url":"https://api.github.com/repos/iDPLcn/idpl_parser/contributors","subscribers_url":"https://api.github.com/repos/iDPLcn/idpl_parser/subscribers","subscription_url":"https://api.github.com/repos/iDPLcn/idpl_parser/subscription","commits_url":"https://api.github.com/repos/iDPLcn/idpl_parser/commits{/sha}","git_commits_url":"https://api.github.com/repos/iDPLcn/idpl_parser/git/commits{/sha}","comments_url":"https://api.github.com/repos/iDPLcn/idpl_parser/comments{/number}","issue_comment_url":"https://api.github.com/repos/iDPLcn/idpl_parser/issues/comments{/number}","contents_url":"https://api.github.com/repos/iDPLcn/idpl_parser/contents/{+path}","compare_url":"https://api.github.com/repos/iDPLcn/idpl_parser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iDPLcn/idpl_parser/merges","archive_url":"https://api.github.com/repos/iDPLcn/idpl_parser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iDPLcn/idpl_parser/downloads","issues_url":"https://api.github.com/repos/iDPLcn/idpl_parser/issues{/number}","pulls_url":"https://api.github.com/repos/iDPLcn/idpl_parser/pulls{/number}","milestones_url":"https://api.github.com/repos/iDPLcn/idpl_parser/milestones{/number}","notifications_url":"https://api.github.com/repos/iDPLcn/idpl_parser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iDPLcn/idpl_parser/labels{/name}","releases_url":"https://api.github.com/repos/iDPLcn/idpl_parser/releases{/id}","created_at":"2015-05-12T14:01:34Z","updated_at":"2015-05-13T13:33:06Z","pushed_at":"2015-05-31T11:19:19Z","git_url":"git://github.com/iDPLcn/idpl_parser.git","ssh_url":"git@github.com:iDPLcn/idpl_parser.git","clone_url":"https://github.com/iDPLcn/idpl_parser.git","svn_url":"https://github.com/iDPLcn/idpl_parser","homepage":null,"size":232,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"iDPLcn:master","ref":"master","sha":"fb0456b063285ffe15c833ceb750d460654c3d85","user":{"login":"iDPLcn","id":9314613,"avatar_url":"https://avatars.githubusercontent.com/u/9314613?v=3","gravatar_id":"","url":"https://api.github.com/users/iDPLcn","html_url":"https://github.com/iDPLcn","followers_url":"https://api.github.com/users/iDPLcn/followers","following_url":"https://api.github.com/users/iDPLcn/following{/other_user}","gists_url":"https://api.github.com/users/iDPLcn/gists{/gist_id}","starred_url":"https://api.github.com/users/iDPLcn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iDPLcn/subscriptions","organizations_url":"https://api.github.com/users/iDPLcn/orgs","repos_url":"https://api.github.com/users/iDPLcn/repos","events_url":"https://api.github.com/users/iDPLcn/events{/privacy}","received_events_url":"https://api.github.com/users/iDPLcn/received_events","type":"Organization","site_admin":false},"repo":{"id":35491507,"name":"idpl_parser","full_name":"iDPLcn/idpl_parser","owner":{"login":"iDPLcn","id":9314613,"avatar_url":"https://avatars.githubusercontent.com/u/9314613?v=3","gravatar_id":"","url":"https://api.github.com/users/iDPLcn","html_url":"https://github.com/iDPLcn","followers_url":"https://api.github.com/users/iDPLcn/followers","following_url":"https://api.github.com/users/iDPLcn/following{/other_user}","gists_url":"https://api.github.com/users/iDPLcn/gists{/gist_id}","starred_url":"https://api.github.com/users/iDPLcn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iDPLcn/subscriptions","organizations_url":"https://api.github.com/users/iDPLcn/orgs","repos_url":"https://api.github.com/users/iDPLcn/repos","events_url":"https://api.github.com/users/iDPLcn/events{/privacy}","received_events_url":"https://api.github.com/users/iDPLcn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/iDPLcn/idpl_parser","description":"Scripts for log sync and parse. ","fork":false,"url":"https://api.github.com/repos/iDPLcn/idpl_parser","forks_url":"https://api.github.com/repos/iDPLcn/idpl_parser/forks","keys_url":"https://api.github.com/repos/iDPLcn/idpl_parser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iDPLcn/idpl_parser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iDPLcn/idpl_parser/teams","hooks_url":"https://api.github.com/repos/iDPLcn/idpl_parser/hooks","issue_events_url":"https://api.github.com/repos/iDPLcn/idpl_parser/issues/events{/number}","events_url":"https://api.github.com/repos/iDPLcn/idpl_parser/events","assignees_url":"https://api.github.com/repos/iDPLcn/idpl_parser/assignees{/user}","branches_url":"https://api.github.com/repos/iDPLcn/idpl_parser/branches{/branch}","tags_url":"https://api.github.com/repos/iDPLcn/idpl_parser/tags","blobs_url":"https://api.github.com/repos/iDPLcn/idpl_parser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iDPLcn/idpl_parser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iDPLcn/idpl_parser/git/refs{/sha}","trees_url":"https://api.github.com/repos/iDPLcn/idpl_parser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iDPLcn/idpl_parser/statuses/{sha}","languages_url":"https://api.github.com/repos/iDPLcn/idpl_parser/languages","stargazers_url":"https://api.github.com/repos/iDPLcn/idpl_parser/stargazers","contributors_url":"https://api.github.com/repos/iDPLcn/idpl_parser/contributors","subscribers_url":"https://api.github.com/repos/iDPLcn/idpl_parser/subscribers","subscription_url":"https://api.github.com/repos/iDPLcn/idpl_parser/subscription","commits_url":"https://api.github.com/repos/iDPLcn/idpl_parser/commits{/sha}","git_commits_url":"https://api.github.com/repos/iDPLcn/idpl_parser/git/commits{/sha}","comments_url":"https://api.github.com/repos/iDPLcn/idpl_parser/comments{/number}","issue_comment_url":"https://api.github.com/repos/iDPLcn/idpl_parser/issues/comments{/number}","contents_url":"https://api.github.com/repos/iDPLcn/idpl_parser/contents/{+path}","compare_url":"https://api.github.com/repos/iDPLcn/idpl_parser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iDPLcn/idpl_parser/merges","archive_url":"https://api.github.com/repos/iDPLcn/idpl_parser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iDPLcn/idpl_parser/downloads","issues_url":"https://api.github.com/repos/iDPLcn/idpl_parser/issues{/number}","pulls_url":"https://api.github.com/repos/iDPLcn/idpl_parser/pulls{/number}","milestones_url":"https://api.github.com/repos/iDPLcn/idpl_parser/milestones{/number}","notifications_url":"https://api.github.com/repos/iDPLcn/idpl_parser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iDPLcn/idpl_parser/labels{/name}","releases_url":"https://api.github.com/repos/iDPLcn/idpl_parser/releases{/id}","created_at":"2015-05-12T14:01:34Z","updated_at":"2015-05-13T13:33:06Z","pushed_at":"2015-05-31T11:19:19Z","git_url":"git://github.com/iDPLcn/idpl_parser.git","ssh_url":"git@github.com:iDPLcn/idpl_parser.git","clone_url":"https://github.com/iDPLcn/idpl_parser.git","svn_url":"https://github.com/iDPLcn/idpl_parser","homepage":null,"size":232,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/iDPLcn/idpl_parser/pulls/2"},"html":{"href":"https://github.com/iDPLcn/idpl_parser/pull/2"},"issue":{"href":"https://api.github.com/repos/iDPLcn/idpl_parser/issues/2"},"comments":{"href":"https://api.github.com/repos/iDPLcn/idpl_parser/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/iDPLcn/idpl_parser/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/iDPLcn/idpl_parser/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/iDPLcn/idpl_parser/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/iDPLcn/idpl_parser/statuses/671b0d2251e21ac274d3a7c643c71776912c1bb0"}}}}